But the method for dynamically updating wireless sensor network program of resisting compromised node attack
Technical field
The present invention relates to a kind of program (also be called as: software, down with) dynamically update method, belong to wireless communication field.
Background technology
In recent years, wireless sensor network receives academia and industrial quarters attention more and more widely because of its wide application prospect.In most of occasions, for new demand is provided, the program on all the sensors node need be upgraded in the base station.Yet, so far, a kind of update method of dynamic routine does not safely and effectively also appear.Some agreement use digital signature ensures the fail safe of program dynamic updating, but this method can consume a large amount of resources, is not useful on the resource-constrained sensor node; Some agreements adopts the matrix orthogonality principle to ensure the fail safe of program dynamic updating, though that this method is calculated cost is few, and the spoof attack that these agreements can't resisting compromised node be started.That is to say that in these agreements, the compromise node can successfully pretend the false program updating message of base station broadcast, and then control whole sensor network.
Summary of the invention
But-the object of the present invention is to provide a kind of method for dynamically updating wireless sensor network program of resisting compromised node attack.
The technical solution adopted for the present invention to solve the technical problems is following:
But the method for dynamically updating wireless sensor network program of resisting compromised node attack mainly comprises with the lower part:
1) before sensor node deployment,
A hash function is confirmed in the base station;
A base station selected Euclidean space; This Euclidean space is decomposed into first subspace and second subspace of quadrature; The dimension of said first subspace is k, and the dimension of said second subspace is n-k, wherein; N is the dimension of said Euclidean space, and k is the quantity of sensor node in the said wireless sensor network;
An identification identifier and the vector that belongs to first subspace are selected for each sensor node in the base station;
Said vector, identification identifier and hash function are loaded onto respectively in each sensor node;
2) behind sensor node deployment,
When the base station need be upgraded the program on all the sensors node; The base station is to sensor network radio program updating message; This program updating message comprises the timestamp that upgrades sequence number, message and send, the identification identifier of the program after upgrading, program version number, program identifier, each sensor node and with the corresponding key hash message authentication code of each sensor node, said key hash message authentication code with the vector of corresponding sensor node as key;
3) each sensor node is received the validity of verifying this message after the said program updating message according to the following steps:
I. sensor node extracts the key hash message authentication code of oneself according to the identification identifier of oneself from the program updating message that receives;
Ii. if the validity of the timestamp of renewal sequence number in the sensor node proving program updating message and message transmission all effective, is then carried out next step; Otherwise refuse this program updating message;
Iii. sensor node obtains the key hash message authentication code according to the vector that is loaded, with the key hash message authentication code that extracts in this key hash message authentication code and the step I relatively, if both equate, accept the program updating message line program of going forward side by side and upgrade; Otherwise refuse this program updating message.
Compared with prior art, the advantage that has of the present invention is:
(1) arbitrary sensor node m even the enemy has compromised, thus secret value C obtained
mBut the enemy issues false program updates information and the checking through other sensor nodes at the base station that can't disguise oneself as, even therefore some node is compromised, the fail safe of this wireless sensor network still can be protected;
(2) ensure (comprising hash function, matrix quadrature and key hash message authentication code) fail safe of wireless sensor network through simple calculations, reliability is high, therefore is particularly suitable for resource-constrained wireless sensor network;
(3) in order to upgrade the program on all the sensors node, a broadcast only need be sent in the base station just can upgrade the program on all the sensors node.
Description of drawings
Fig. 1 is the workflow diagram of method for dynamically updating wireless sensor network program of the present invention.
Embodiment
Relevant technical term is following:
The M program
X
PidThe identifier of program M
X
VerThe version of program M
HMAC () key hash message authentication code (keyed hash message authentication code)
The dot product of AB matrix A and matrix B
A
TThe transposition of matrix A
|| polyphone connects operation
ID
iThe identifier of node i
Referring to Fig. 1, but the method for dynamically updating wireless sensor network program of the present invention's resisting compromised node attack is following:
A. before sensor node deployment, a hash function h is confirmed in the base station; And the Euclidean space V of base station selected n dimension is decomposed into the subspace of two quadratures, the i.e. first subspace V with V
1With the second subspace V
2, V wherein
1Be the k dimension, V
2Be the n-k dimension, wherein, k is the quantity of all the sensors node of this wireless sensor network.In addition, the base station is that each sensor node i selects an identification identifier ID
iWith one belong to V
1Vectorial C
i, i=1,2K, k, C
iLength should be enough this C to avoid guessing greatly with the method for exhaustion
i, C for example
iLength can be 512 bits.Vector C
i, hash function h and identification identifier ID
iBe installed in each sensor node.
B. behind sensor node deployment, when the base station need be upgraded the program on all the sensors node, the base station was to all sensor node broadcasts program updating message M
Adv (j),
ID
k, HMAC (C
k, (j||t
j|| M||ID
k|| X
Pid|| X
Ver)), j=1 wherein, 2Kk, the j representation program upgrades sequence number, t
jMessage M is sent in expression
Adv (j)Timestamp, the program after M representes to upgrade.
C. work as arbitrary sensor node i and receive message M
Adv (j)The time, for this message is verified, need carry out following operation:
1) sensor node i is according to the identifier ID of oneself
i, extract oneself key hash message authentication code HMAC (C
i, (j||t
j|| M||ID
i|| X
Pid|| X
Ver)).
2) validity of checking j is if j is less than or equal to the j that is stored in node
*The time, this message of sensor node refusal; Otherwise sensor node thinks that j is fresh and replaces j with j
*(when initial, the j of node storage
*=0).And continuation checking t
jValidity, the current time of sensor node is Clock, if | Clock-t
j|<Δ t, get into next step, otherwise this message of sensor node refusal.Here Δ t is the time delay threshold value of the program updating message that pre-sets.
3) sensor node is according to the C of oneself
iCalculate HMAC (C
i, (j||t
j|| M||ID
i|| X
Pid|| X
Ver)), with the HMAC (C that calculates
i, (j||t
j|| M||ID
i|| X
Pid|| X
Ver)) with 1) and in the HMAC (C that extracts
i, (j||t
j|| M||ID
i|| X
Pid|| X
Ver)) compare, if equate that sensor node is accepted this broadcast and upgraded the program of self; Otherwise this message of sensor node refusal;
Each sensor node carries out above a series of check to the program updates broadcast of being received, if this message can be through above whole check, then this sensor node is accepted this broadcast; Otherwise, this this broadcast of sensor node refusal.Suppose the enemy a certain sensor node m that compromised, thereby obtained the secret value C on this sensor node
mBut the enemy can't pretend the checking that the base station is issued false program updates information and passed through other sensor nodes.Therefore, even under the situation that sensor node is compromised, the present invention also can ensure the fail safe of the program dynamic updating of sensor network.