Disclosure of Invention
Aiming at the problems in the related art, the invention provides a wireless sensor network communication method and a wireless sensor network communication system based on a layered symmetric key pool, so as to overcome the technical problems in the prior art.
For this purpose, the invention adopts the following specific technical scheme:
according to one aspect of the present invention, there is provided a wireless sensor network communication method based on a hierarchical symmetric key pool, the method comprising the steps of:
S1, realizing upper layer group communication between the 0 th layer communication base station and the 1 st layer cluster head node by using a group communication method;
S2, realizing lower layer group communication between the layer 1 cluster head node and the layer 2 sensor node under normal conditions by using a group communication mode;
S3, realizing lower layer group communication between the 1 st layer cluster head node and the 2 nd layer sensor node under the condition that the cluster head node fails by a group communication method;
s4, updating the key pool corresponding to the layer 1 cluster head node according to a key pool updating method;
When the cluster head node issues a system public and private key for the sensor node, the current issuing time is acquired, a random number with a corresponding size is acquired from a key pool through the issuing time, the random number is used as a system private key corresponding to the sensor node, a system public key is calculated according to the system private key, meanwhile, the private key of the sensor node can be calculated according to the system private key, the public private key, the system public private key and algorithm parameters are stored in a memory of the sensor node, the public key of the cluster head node and the private key corresponding to the sensor node are obtained through calculation when power is lost.
Further, the step of S1 implementing upper layer group communication between the layer 0 communication base station and the layer 1 cluster head node by using a group communication method includes the following steps:
s11, the layer 0 communication base station initiates communication to the layer 1 cluster head node by using a group communication method;
s12, the layer 1 cluster head node initiates communication to the layer 0 communication base station by using a group communication method.
Further, the step of the layer 0 communication base station in S11 initiating communication to the layer 1 cluster head node by using a group communication method specifically includes the following steps:
s111, generating a first time stamp according to the message sent by the layer 0 communication base station, and calculating by the layer 0 communication base station to obtain a key pool of the layer 1 cluster head node;
S112, the layer 0 communication base station takes out a secret key from a secret key pool of the layer 1 cluster head node;
S113, after the layer 0 communication base station takes out a secret key, encrypting a message sent by the layer 0 communication base station by using the secret key to obtain a first encrypted message, calculating a first message authentication code for the identity number of the layer 0 communication base station, the first time stamp and the message sent by the layer 0 communication base station by using the secret key, and simultaneously sending the first encrypted message, the first message authentication code, the identity number of the layer 0 communication base station and the information of the first time stamp to the layer 1 cluster head node;
S114, after receiving the information, the layer 1 cluster head node takes out a secret key from a secret key pool of the node to decrypt, and meanwhile, the secret key is used for calculating a message authentication code of the identity number of the layer 0 communication base station, the first time stamp and the message sent by the layer 0 communication base station and comparing and verifying the message authentication code with the received first message authentication code.
Further, the step of extracting the key in S112 includes the following steps:
s1121, calculating to obtain an initial position pointer of the key, and sequentially calculating step sizes;
s1122, sequentially calculating pointers for extracting random codes, and obtaining a plurality of pointers for extracting random codes;
s1123, sequentially taking out a plurality of bits of key data at corresponding positions from a key pool according to a plurality of pointers for extracting random codes;
and S1124, if the key pool size is exceeded, returning to the key pool head by modulo the key pool length.
Further, the step of S2 implementing the lower layer group communication between the layer 1 cluster head node and the layer 2 sensor node in the normal case by using the group communication manner includes the following steps:
S21, the layer 1 cluster head node initiates private communication to the layer 2 sensor node by using a group communication method;
s22, the layer 2 sensor node initiates private communication to the layer 1 cluster head node by using a group communication method.
Further, the step of initiating, by the layer 1 cluster head node in S21, private communication to the layer 2 sensor node using the group communication method includes the steps of:
S211, calculating to obtain a first key by using the layer 1 cluster head node;
S212, the layer 1 cluster head node sends identity information to be authenticated to the layer 2 sensor node;
S213, the layer 2 sensor node receives the identity information to be authenticated and verifies, and after verification is passed, the layer 2 sensor node trusts the identity of the layer 1 cluster head node and the message sent by the layer 1 cluster head node.
Further, the step S3 of implementing the lower layer group communication between the layer 1 cluster head node and the layer 2 sensor node under the condition that the cluster head node fails by using a group communication method includes the following steps:
S31, the layer 0 communication base station announces that the father node of the layer 2 sensor node ID ij is modified to be ID I, and calculates to obtain a new layer 1 cluster head node replacement key and key pool, and also calculates to obtain the original layer 1 cluster head node replacement key and key pool;
S32, using the 0 th layer communication base station to take out a new system private key and a new system public key corresponding to the original 2 nd layer sensor node ID ij, and calculating to obtain a new private key corresponding to the 2 nd layer sensor node ID IJ, packing the information by the 0 th layer communication base station to obtain first packing information, and recovering to obtain a public private key of the original 1 st layer cluster head node ID i and the original 2 nd layer sensor node ID ij, and simultaneously, using the 0 th layer communication base station to calculate to obtain a second secret key;
S33, the layer 0 communication base station utilizes the second secret key to carry out symmetric encryption algorithm calculation on the message with the first packing information and the signature of the first packing information, and packs the message of the calculation result to obtain second packing information;
S34, the layer 0 communication base station is utilized to take out a secret key from a secret key pool of a new layer 1 cluster head node ID I, and the secret key is utilized to calculate a message authentication code, and meanwhile, the layer 0 communication base station packages the message again to obtain third package information and sends the third package information to the new layer 1 cluster head node ID I;
S35, a new layer 1 cluster head node ID I receives the third package information and performs decryption authentication, and meanwhile, the new layer 1 cluster head node ID I sends the second package information to an original layer 2 sensor node ID ij;
S36, the original layer 2 sensor node ID ij receives the second package information and calculates to obtain a third key, meanwhile, the original layer 2 sensor node ID ij decrypts the second package information by using the third key and verifies the information, after verification, the original layer 2 sensor node ID ij updates its own identity number as ID IJ, the father node is ID I and updates public and private keys and a system public key, then the updated information is sent to a new layer 1 cluster head node ID I, the new layer 1 cluster head node ID I confirms that the new layer 2 sensor node ID IJ is a child node thereof after receiving the updated information, and sends the updated information to the layer 0 communication base station, and after the layer 0 communication base station confirms the information, the issuing time corresponding to the new layer 2 sensor node ID IJ is stored.
Further, the step of S4 updating the key pool corresponding to the layer 1 cluster head node according to the key pool updating method includes the following steps:
S41, original layer 1 cluster head node ID i generates request content for updating a key pool, acquires a corresponding time stamp, and sends a key pool update request to the layer 0 communication base station;
S42, after decrypting and authenticating the message, the 0-layer communication base station generates a new identity number ID I of the 1-layer cluster head node ID i and calculates a new replacement key, adds the new 1-layer cluster head node ID I and the new replacement key into the message content, encrypts and sends the message to the original 1-layer cluster head node ID i, and the original 1-layer cluster head node ID i decrypts and authenticates the message;
S43, obtaining a new ID I and a new replacement key by the original layer 1 cluster head node ID i, sectionally restoring a key pool in the node by utilizing the original replacement key in the security chip and a symmetric key science algorithm, encrypting by using the new replacement key, and outputting the re-encrypted key section to a corresponding position of a key pool storage area of the original layer 1 cluster head node ID i for covering and storing;
s44, the original layer 1 cluster head node ID i updates the replacement key and updates the ID I, and meanwhile, the child node of the cluster head node is updated with the identity and public and private key pairs.
Further, outputting the re-encrypted key segment in S43 to the corresponding location of the key pool storage area of the original layer 1 cluster head node ID i for overlay storage, where the steps include:
S431, the original layer 1 cluster head node ID i takes out a section of key of the key pool and inputs the section of key into the security chip;
s432, decrypting the key by using the original replaced key to obtain a key with the same position as the corresponding position of the key pool of the communication base station;
s433, encrypting a key with the same position as the corresponding position of the key pool of the communication base station by using the new replacement key;
S434, outputting the encrypted secret key to the security chip to form a section of secret key of the secret key pool.
According to another aspect of the present invention, there is provided a wireless sensor network communication system based on a hierarchical symmetric key pool, the system including a plurality of layers of nodes including a layer 0 node, a layer 1 node, and a layer 2 node, wherein the layer 0 node is a communication base station of the wireless sensor network, the layer 1 node is a cluster head node, and the layer 2 node is a sensor node;
The layer 0 node is provided with a layer 0 key pool and corresponding replacement keys, the layer 1 node is provided with a plurality of cluster head nodes, each cluster head node is provided with a unique key pool and corresponding replacement keys, each cluster head node key Chi Junyou is obtained by calculating the replacement keys owned by the nodes, the replacement keys of the cluster head nodes are obtained by calculating the identity numbers of the nodes by the replacement keys of the layer 0 node, the replacement keys of the layer 0 node and the layer 1 node are stored in a local secure storage chip, and the layer 2 node is provided with a plurality of sensor nodes.
The beneficial effects of the invention are as follows:
1) In the scene of group communication, the invention further enhances the use safety of the symmetric key pool by combining the symmetric key pool and the replacement key, so that the safety of the group communication based on the symmetric key pool can be ensured under the extreme condition that a certain subgroup symmetric key pool is cracked. Since a plurality of subgroups are divided in the group, when one subgroup key pool is broken, other subgroups are different from the other subgroup key pools, so that the security is not affected, and when one subgroup key pool is broken, the key pool of a group administrator cannot be deduced due to the protection of the replacement key, so that the security is not affected.
2) The key taking method based on the symmetric key pool comprises the steps of firstly generating a replaced key pool by using a replaced key, and then taking out a plurality of key bits from the key pool one by adopting different step sizes, wherein each step size is different. In the case that the symmetric key pool is shared by the group members, the key taking mode is not known by the group members, and the privacy is high.
3) The method for updating the key pool can update the key pool only by transmitting a small amount of keys, and the key transmission quantity of the key updating scheme is small and is easy to realize.
4) In the group communication system based on the key pool, the positions of all members with the group key pool are classified according to grades, and the protection measures and the key pools of different grades are different. The protection measures of the important class members are good and are not easy to capture, and the protection measures of the unimportant class members are relatively poor, but because the key pool is obtained by encrypting the key pool of the important class members, the key pool is not greatly influenced even being captured, and the invalidation of the whole group communication system is not caused.
Detailed Description
For the purpose of further illustrating the various embodiments, the present invention provides the accompanying drawings, which are a part of the disclosure of the present invention, and which are mainly used to illustrate the embodiments and, together with the description, serve to explain the principles of the embodiments, and with reference to these descriptions, one skilled in the art will recognize other possible implementations and advantages of the present invention, wherein elements are not drawn to scale, and like reference numerals are generally used to designate like elements.
According to the embodiment of the invention, a wireless sensor network communication method and a wireless sensor network communication system based on a hierarchical symmetric key pool are provided. In a communication group, the present invention assumes that all member IDs have the layer number of that ID. The smaller the layer number, the better the security protection, and the less likely it is to be trapped by an adversary.
The invention will now be further described with reference to the accompanying drawings and detailed description, wherein, according to one embodiment of the invention, as shown in fig. 1-2, there is provided a wireless sensor network communication method based on a hierarchical symmetric key pool, the method comprising the steps of:
s1, upper layer group communication (the upper layer group communication between the layer 0 communication base station and the layer 1 cluster head node is realized by using a group communication method);
In this embodiment, the communication base station of layer 0 is called a, the replacement key of a is KR 0, the identity number of a is ID 0, a certain cluster head node of layer 1 is called B, the replacement key of B is KR B, and the identity number of B is ID B.
Wherein, the step S1 comprises the following steps:
s11, communicating a layer 0A with a layer 1B (the layer 0 communication base station initiates communication to the layer 1 cluster head node by using a group communication method);
Assume that the content of the message to be sent by group member a is NTFA and a timestamp TNTFA is generated for the message. A calculates the key pool of B firstly, A calculates the replacement key KR B of B according to the self replacement key KR 0 and the ID B of B, and then comprehensively calculates the key pool of B by KR B and the key pool of A, and the length of the key pool is KPL.
A takes out a key KTA from a key pool of B, the key is totally N bits, the specific calculation for obtaining KTA can be described by referring to the system private key generation mode, and the specific description flow is as follows:
An initial position pointer pk=fpk (tnfa) mod KPL of the key KTA is calculated, where mod represents a modulo operation. Step :LK1=FLK(PK||TNTFA),LK2=FLK(LK1||TNTFA),LK3=FLK(LK2||TNTFA),…,LKN=FLK(LKN-1||TNTFA). functions FPK and FLK are calculated in sequence as arbitrary specified functions. The pointer PK1=PK+LK1mod KPL,PK2=PK1+LK2mod KPL,…,PKN=PKN-1+LKNmod KPL.PK1 for extracting the random code is then calculated in turn to point to the beginning of the key KTA, i.e. the first bit position, PK 2 to the second bit position of the key KTA, and so on. And sequentially taking out the key data of N bits in the corresponding position from the key pool according to the PK 1、PK2、…、PKN. If key Chi Daxiao KPL is exceeded, the key pool header is returned by modulo the KPL.
A takes out the symmetric key KTA with group member B and encrypts NTFA with KTA to obtain { NTFA } KTA. KTA pair ID 0 TNTFA and NTFA calculate the message authentication code to get the MAC (ID 0 TNTFA NTFA, KTA). The encrypted information, the message authentication code, is sent to group member B along with IDs A, TNTF, which may be expressed as IDs 0||TNTFA||{NTFA}KTA||MAC(ID0 TNTFA NTFA, KTA.
B, after receiving, the symmetric key KTA is taken out from the own key pool by the same method, the KTA is used for decrypting { NTFA } KTA to obtain message content NTFA, the KTA is used for calculating message authentication codes of IDs 0, TNTFA and NTFA and comparing the message authentication codes with the received message authentication codes, if the two are consistent, the authentication is passed, the message content NTFA is trusted, and if the authentication is not passed, the message content NTFA is not trusted.
S12, the layer 1B communicates with the layer 0A (the layer 1 cluster head node initiates communication to the layer 0 communication base station by using a group communication method);
Assume that group member B has a NTFB message content to send out and generates a timestamp TNTFB for the message. B takes out a key KTB from the own key pool according to the method in S11, and the key is totally N bits. Then, { NTFB } KTB is obtained by encrypting NTFB using KTB. Calculating the message authentication code using KTB for IDs B, TNTFB, and NTFB yields the MAC (ID B TNTFB NTFB, KTB). The encrypted information, the message authentication code, is sent to group member a along with IDs B, TNTFB, which may be represented as IDs B||TNTFB||{NTFB}KTB||MAC(IDB TNTFB NTFB, KTB.
After receiving A, the method in S11 calculates the key pool of B and takes out KTB, uses KTB to decrypt { NTFB } KTB to obtain message content NTFB, uses KTB to calculate message authentication codes for IDs B, TNTFB and NTFB and compares the message authentication codes with the received message authentication codes, if the two codes are consistent, the two codes show that the verification is passed, the message NTFB is trusted after the verification is passed, and if the verification is not passed, the message NTFB is not trusted.
S2, lower layer group communication under normal conditions (the lower layer group communication between the 1 st layer cluster head node and the 2 nd layer sensor node under normal conditions is realized by using a group communication mode);
wherein, the step S2 comprises the following steps:
S21, carrying out private communication on the 1 st layer A and the 2 nd layer B;
The cluster head node a calculates a public key pkb=h of the node B according to the identity number ID B of the node B (ID B). A is obtained by calculation by utilizing own private key and public key of node B Node a obtains a timestamp T1, and performs a message authentication algorithm on the timestamp by using K AB to obtain k1=mac (T1, K AB), where MAC (m, K) is an expression calculated by using the key K to perform the message authentication algorithm on the message content m.
Let INFOA be the service information of the wireless sensor network of the node A, the node A calculates T1I INFOA based on ID cryptographic signature algorithm by using the private key SKA_B to obtain SIGA=SIG (T1I INFOA, SKA_B), wherein SIG (m, k) is the expression of the key k based on ID cryptographic signature algorithm calculation for the message content m. The node A encrypts the INFOA SIGA by using K1 to obtain { INFOA SIGA } K1, and calculates the ID B||IDA T1 SIGA } K1 by using a key K1 to obtain the MAC (ID B||IDA T1 SIGA K1, K1) by using a message authentication algorithm. Node a sends the encrypted information, the message authentication code, along with ID A、IDB, T1 to node B, the sent information may be expressed as IDA||IDB||T1||{INFOA||SIGA}K1||MAC(IDB||IDA||T1||{INFOA||SIGA}K1,K1).
After the node B receives the public key pka=h of the node a (ID A) calculated from the identity number ID A of the node a. B is obtained by calculating the private key of the B and the public key of the node AThe node B performs a message authentication algorithm on the timestamp T1 in the message using K BA to obtain K1' =mac (T1, K BA). Available according to ID cryptography: Thus, K1' =k1. The node B may decrypt { info a|siga } K1 with the key K1' to obtain the correct info a|siga and verify the message authentication code MAC (ID B||IDA |t1|{ info a|siga } K1, K1). And finally, the node B performs signature verification on the signature SIGA by using the calculated public key PKA of the node A. And B trusts the identity of A and the message sent by A after the verification is passed.
S22, the layer 2B is in private communication with the layer 1A.
The communication method in this case is basically the same as the method of S21.
The node B calculates the public key pka_b=h of the cluster head node a according to the identity number ID A of the cluster head node a (ID A). B is obtained by calculating the private key of the B and the public key of the node AThe node B obtains a timestamp T2, and performs a message authentication algorithm on the timestamp using K BA to obtain k2=mac (T2, K BA).
Let info be the service information of the wireless sensor network of the node B, the node B uses the private key SKB to calculate T2 i info based on the ID cryptographic signature algorithm to obtain sigb=sig (T2 i info B, SKB). The node B encrypts the InfoB SIGB by using K2 to obtain { InfoB SIGB } K2, and calculates the ID A||IDB T2 { InfoB SIGB } K2 by using a key K2 to obtain the MAC (ID A||IDB T2 { InfoB SIGB } K2, K2) by using a message authentication algorithm. Node B transmits the encrypted information, the message authentication code, along with the IDs B、IDA, T2 to node a, the transmitted information may be expressed as IDB||IDA||T2||{INFOB||SIGB}K2||MAC(IDA||IDB||T2||{INFOB||SIGB}K2,K2).
After node a receives, it calculates the public key pkb=h of node B from the identity number ID B of node B (ID B). A is obtained by calculation by utilizing own private key and public key of node BNode a performs a message authentication algorithm on the timestamp T2 in the message using K AB to obtain K2 '=mac (T2, K AB), K2' =k2. The node A decrypts the { INFOB SIGB } K2 by using the key K2' to obtain the correct INFOB SIGB, and verifies the message authentication code MAC (ID A||IDB T2 { INFOB SIGB } K2, K2). And finally, the node A performs signature verification on the signature SIGB by using the public key PKB of the node B obtained through calculation. And verifying the identity of the trust B and the message sent by the trust B after the verification is passed.
S3, lower layer group communication under the condition of failure of the cluster head node (the lower layer group communication between the 1 st layer cluster head node and the 2 nd layer sensor node under the condition of failure of the cluster head node is realized through a group communication method);
Wherein, the step S3 comprises the following steps:
The reason for the failure of the cluster head node may be that the cluster head node is knocked down, stolen, powered off, etc., and after the failure, the cluster head node is not trusted any more, and the base station sends out a new cluster head node ID I to replace the original cluster head node ID i. Let ID i be originally connected with a plurality of sensor nodes, and the jth node be ID ij. After the cluster head node is replaced, a plurality of sensor nodes to which the ID i is originally connected need to be connected to the ID I.
The communication base station announces that the message content of changing the parent node of ID ij to ID I and changing ID ij to ID IJ is NTF, time TNTF. The communication base station calculates a replacement key KR I=FKRID(IDI,KR0 for the new cluster head node). And calculating a key pool of the new cluster head node by using the replacement key. A replacement key KR i=FKRID(IDi,KR0 of the old cluster head node of ID i is also calculated, and a key pool of the old cluster head node is calculated by using the replacement key KR i.
The communication base station obtains a new system private key sIJ of the sensor node corresponding to the ID ij and a new system public key PIJ pub = sIJ ·p from a key pool of the new cluster head node by TNTF, and calculates to obtain a private key SK IJ=sIJ*H(IDIJ corresponding to the ID IJ. The communication base station packs the information to obtain NTF-I-J=NTF||ID i||IDI||IDIJ||SKIJ||PIJpub. The communication base station takes out the moment about the node ID ij from the moment backup of the node ID i, and obtains the public and private key PKH ij/SKHij of the node ID i for communication with the node ID ij through restoration of the node ID i key pool. The communication base station performs signature SIG-I-j=sig based on ID cryptography on NTF-I-J using SKH ij (NTF-I-J, SKH ij). The communication base station takes NTF-I-J I SIG-I-J as message content NTF sensor. The communication base station calculates a public key PK ij=H(IDij of the node ID ij according to the identity number ID ij of the node. Calculated using node ID i private key and node ID ij public keyThe communication base station obtains a time stamp T1 and performs a message authentication algorithm on the time stamp by using K HS to obtain k1=mac (T1, K HS).
The communication base station calculates the NTF sensor by using the key K1 to obtain { NTF sensor } K1. The communication base station packages the message to obtain NTF-i-j=IDij||IDi||T1||{NTFsensor}K1||MAC(IDij||IDi||T1||{NTFsensor}K1,K1).
The communication node extracts the key KBI from the key pool of the ID I node using the time stamp T1, and the specific generation procedure may refer to step S11 described above. The communication base station encrypts the NTF-i-j TNTF by using the key KBI to obtain { NTF-i-j TNTF } KBI and calculates the message authentication codes of the IDs 0, T1 and NTF-i-j TNTF to obtain the MAC (ID 0 T1 NTF-i-j TNTF, KBI). The communication base station packages the message to obtain ID 0||T1||{NTF-i-j||TNTF}KBI||MAC(ID0 T1 NTF-i-j TNTF, KBI. The communication base station sends a message to the new cluster head node ID I.
After the new cluster head node ID I is received, it is taken out KBI from the local key pool according to the timestamp T1 in the message in the same way, and the message is decrypted and authenticated by KBI to obtain NTF-i-j and TNTF, which refers to step S11 herein. The cluster head node ID I uses the time TNTF to calculate a system public private key and a communication public private key for the node ID IJ. While cluster head node ID I sends NTF-i-j to sensor node ID ij.
After the sensor node ID ij receives the NTF-i-j, the public key PKH ij=H(IDi of the node ID i is obtained by calculation according to the identity number of the old cluster head node ID i, and the private key SK ij is taken out and calculated to obtainK HS=KSH. Node ID ij calculates K1' =mac (T1, K SH) using K SH for timestamp T1. Node ID ij decrypts message NTF-i-j using key K1' and verifies the message, and reference is made to step S21 for a specific flow. Node ID ij updates its own identity number to ID IJ, parent node to ID I, public private key to PK IJ/SKIJ, and system public key to PIJ pub. And sends the updated message to the cluster head node ID I in the manner of step S22. The cluster head node ID I confirms that the sensor node ID IJ is a child node thereof after receiving the update message of the ID IJ is sent to the communication base station by the method in step S12. After the communication base station confirms the message, the issuing time corresponding to the ID IJ is stored.
S4, updating a key pool of the lower node (updating the key pool corresponding to the layer 1 cluster head node according to a key pool updating method);
Wherein S4 comprises the steps of:
in this embodiment, a process of updating a key pool is implemented for a cluster head node, so that the cluster head node actively updates its own identity and its corresponding key pool to improve security. The cluster head node identity number updated by the key pool in this embodiment is set as ID i, and ID ij is set as the identity number of a child node of the cluster head node.
The cluster head node ID i generates the request content NTFH for updating the key pool, and the acquisition time stamp is THTFH. A key pool update request is sent to the communication base station in the method in step S12.
After decrypting and authenticating the message, the communication base station generates a new first layer ID I and calculates a new replacement key KR I by using ID I. The new identity number ID I and the new replacement key KR I are added to the message content and sent encrypted to the cluster head node ID i in the manner of step S11. The cluster head node ID i decrypts the message and authenticates the message.
The cluster head node ID i gets a new identity number ID I and a new replacement key KR I. The cluster head node ID i uses the original replacement key KR i and the symmetric cryptography algorithm in the security chip to restore the key pool segment in the node and uses the new replacement key KR I for encryption. And outputting the re-encrypted key segment to the corresponding position of the key pool storage area of the cluster head node ID i for overlay storage. The specific flow is as follows:
1) ID i takes out a section of key K-i of the key pool and inputs the section of key K-i into the security chip;
2) Decrypting the K-i by using the KR i to obtain a key KA with the same position as the corresponding position of the key pool of the communication base station;
3) Encrypting KA by using KR I to obtain K-I;
4) The K-I output security chip is used as a section of key of the key pool.
The cluster head node ID i updates the replacement key to KR I and updates the identity number to ID I. The cluster head node needs to update the identity and public and private key pairs of its child nodes in the same way as in step S3.
According to another aspect of the present invention, as shown in fig. 3-4, a wireless sensor network communication system based on a hierarchical symmetric key pool is provided, the system including a plurality of layers of nodes, such as a layer 0 node, a layer 1 node, a layer 2 node, and the like. The layer 0 is a communication base station of the wireless sensor network, the layer 1 node is a cluster head node, and the layer 2 node is a sensor node.
In the invention, a layer 0 node is provided with a layer 0 key pool and a replacement key KR 0 based on a symmetrical key pool of a layered structure. The implementation scene of the invention is wireless sensor network communication under a communication base station. The layer 0 node, i.e. the communication base station, has only 1 and also serves as a group manager of the wireless sensor network. The base station is provided with an original key pool and a replacement key, wherein the original key pool is generated by a true random number, the layer 1 is provided with a plurality of cluster head nodes, each cluster head node is provided with a unique key pool and the replacement key, the key pool of each node is obtained by calculating the original key pool through the replacement key owned by each node, and the layer 2 is provided with a plurality of sensor nodes. The replacement key of the layer 1 node, i.e. the cluster head node, is obtained by calculating the identity numbers of all nodes by the replacement key of the layer 0 communication base station. Let the layer 1 i node identity number, i.e. ID, be ID i and the replacement key of the communication base station be KR 0. The node replacement key KR i=FKRID(IDi,KR0) is obtained by calculating IDi using the replacement key KR 0, wherein FKRID is an irreversible function, preferably a message authentication code, MAC function, or hash function. The replacement keys of the layer 0 and layer 1 nodes are stored in a local secure memory chip, such as a TPM/TCM, and have an anti-disassembly function, cannot be obtained, and because FKRID functions are located in the secure chip and have no output interface, the calculation result, namely, the lower-level replacement keys obtained by the replacement keys, cannot be obtained (except the layer 0 node, because an administrator of the layer 0 node grasps PIN codes of all the secure memory chips and can execute key import and export operations), and the layer 2 sensor node is limited by power consumption, memory capacity and cost and does not have a secure chip.
The key substitution formula is krs=fkr (K, KR). Wherein FKR is a reversible function, preferably a symmetric encryption function, and KRS has a length equal to K.
The procedure for replacing the key pool for a layer 1 node is as follows. Averagely split the layer 0 key pool into multiple segments of keys, let n-th segment be K n, calculate KRS ni=FKR(Kn,KRi for layer 1 node ID i using the key replacement formula), and replace K n with KRS ni. After the replacement is completed, a key pool of the 1 st layer node ID i which is equal to the length of the 0 th layer key pool is obtained. In summary, it can be seen that the key pool of a certain node in layer 1 is obtained by performing comprehensive operation on the replaced key of the node and the parent node, namely the layer 0 key pool. And by analogy, the key pool of each node of the layer 1 can be obtained by calculating the replacement key of each node of the layer 1.
The invention adopts an algorithm system based on ID cryptography. The algorithm parameters are as followsWherein q is a large prime number, G 1 and G 2 are respectively q-order addition cyclic group and multiplication cyclic group, and mapping is performedG 1×G1→G2 becomes bilinear map, P is a generator randomly selected in G 1, H is a hash function defined as {0,1} *→G1 *, and ad_ paras is other system parameters in the algorithm. The communication base station distributes algorithm parameters to the respective cluster head nodes and sensor nodes.
The cluster head node generates a pair of system public and private keys for each child node that it is subordinate to. When a cluster head node issues a public and private key for a certain sensor node, the cluster head node can acquire the current issuing time T. And acquiring random numbers with corresponding sizes from the key pool through the time T. Let the obtained random number be s, the size s epsilon Z q *. The random number s is calculated as follows:
An initial position pointer ps=fpk (T) mod KPL of the random number s is calculated, where mod represents a modulo operation. Step :Ls1=FLK(Ps||T),Ls2=FLK(Ls1||T),Ls3=FLK(Ls2||T),…,LsN=FLK(LsN-1||T). functions FPK and FLK are calculated in sequence as arbitrary specified functions. The pointer Ps1=Ps+Ls1mod KPL,Ps2=Ps1+Ls2mod KPL,…,PsN=PsN-1+LsNmod KPL.Ps1 for extracting the random code is then calculated in turn to point to the beginning of the random number s, i.e. the first bit, ps 2 to the second bit of the random number s, and so on. And sequentially taking out the random number data of N bits in the corresponding position from the key pool according to Ps 1、Ps2、…、PsN. If key Chi Daxiao KPL is exceeded, the key pool header is returned by modulo the KPL.
The random number s is used as a system private key of the corresponding sensor node, namely a system master key, and the system public key is calculated through the system master key to obtain P pub =s.P. The public and private keys of the system can be calculated to obtain the public and private key PK sensor=H(IDsensor)/SKsensor=s*PKsensor of the sensor node, wherein PK sensor is the public key of the sensor node, and SK sensor is the private key of the sensor node. The sensor node stores the public and private key pair, the system public key and the algorithm parameter in a memory of the sensor node, and the power failure is lost. And the cluster head node would also calculate the public key PK head=H(IDhead) and the private key SK head=s*PKhead corresponding to the sensor node.
In the wireless sensor network communication system based on the layered symmetric key pool, if a plurality of sub-nodes, namely a plurality of sensor nodes, exist under one cluster head node, the cluster head node can execute the key issuing flow for a plurality of times. Meanwhile, the cluster head node can store the issuing time and algorithm parameters for generating the public and private keys of the system in the security chip and backup the issuing time and algorithm parameters to the communication base station. After the cluster head node or the sensor node is captured, an adversary can acquire a key pool of the node, but cannot acquire related issuing time, algorithm parameters and public and private keys. Because the system master keys corresponding to each sensor node are different, the security of the algorithm system, the cluster head node and the child nodes thereof is not affected even if one of the system master keys is cracked.
In summary, by means of the above technical solution of the present invention, the present invention combines the symmetric key pool and the replacement key, in the scenario of group communication, the use security of the symmetric key pool is further enhanced, so that in the extreme case that a certain subgroup symmetric key pool is cracked, the security of group communication based on the symmetric key pool can still be ensured. Since a plurality of subgroups are divided in the group, when one subgroup key pool is broken, other subgroups are different from the other subgroup key pools, so that the security is not affected, and when one subgroup key pool is broken, the key pool of a group administrator cannot be deduced due to the protection of the replacement key, so that the security is not affected. In addition, the key taking method based on the symmetric key pool comprises the steps of firstly generating a replaced key pool by using a replaced key, then taking out a plurality of key bits from the key pool one by adopting different step sizes, wherein each step size is different. In the case that the symmetric key pool is shared by the group members, the key taking mode is not known by the group members, and the privacy is high. In addition, the method for updating the key pool can update the key pool only by transmitting a small amount of keys, and the key transmission quantity of the key updating scheme is small and is easy to realize. In addition, in the group communication system based on the key pool, the positions of all members with the group key pool are classified according to grades, and different grades of protection measures and key pools are different. The protection measures of the important class members are good and are not easy to capture, and the protection measures of the unimportant class members are relatively poor, but because the key pool is obtained by encrypting the key pool of the important class members, the key pool is not greatly influenced even being captured, and the invalidation of the whole group communication system is not caused.
The technical features of the above-described embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above-described embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The above examples illustrate only a few embodiments of the invention, which are described in detail and are not to be construed as limiting the scope of the invention. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the invention, which are all within the scope of the invention. Accordingly, the scope of protection of the present invention is to be determined by the appended claims.