Disclosure of Invention
Based on the above thought, the invention provides an authentication key establishment method based on a light certificate and suitable for a low configuration environment of a wireless sensor network, and provides an authentication key transmission device for implementing the method on TelosB running TinyOS, wherein an ECIES algorithm is used for encryption/decryption operation in the transmission device, and an ECDSA algorithm is used for digital signature operation.
The main structure of the authentication key establishment method provided by the invention is shown in fig. 1, and comprises the following two stages:
stage one: pre-distribution of keys
This phase is implemented in two steps:
step 1, initializing; firstly, selecting security parameters according to the application scene security requirements of the method, and then selecting used public key primitives, Hash functions and parameters related to the primitives according to the security parameters;
step 2, generating a public and private key pair and a certificate and loading the public and private key pair and the certificate into a node;
first of all a private/public key pair (d) is generated for the key generation center KGC
s,Q
s) Subsequently, a private/public key pair is generated by the KGC for each node (d)
i,Q
i) And simultaneously generating a light certificate for the method, wherein the light certificate of the method is defined as:
then the public key of KGC, the private/public key pair (d) of the node
i,Q
i) Certificates, used public key primitives, Hash functions, parameters related to the primitives and the like are loaded into the nodes along with the application programs;
and a second stage: key establishment
(2a) After the sensor node loaded with the security material is deployed, the following key negotiation process is started, and the nodes (such as a) which participate in the negotiation firstly create a New1 packet and broadcast the packet:
New1:=NonceA||CertA;
(2b) when A receives a New1 packet of a certain neighbor node B, if A does not establish a shared key with B, the certificate Cert in the packet is verified
BAfter the verification is passed, the node A stores the public key and the related information of the node B into a neighbor list; a will then generate a random Key
AUse it as the other partyPublic key encryption into
And with the received Nonce
BHash is combined, signed by the private key of A and
constructing a New2 packet to be sent to B, and recording the random Key Key
AEntering the record of the neighbor list B; wherein the New2 packet structure is as follows:
(2c) when A receives a New2 packet of a neighbor node B, if the A does not receive the New1 operation of the B, the A is sent to a queue cache, otherwise, the A is combined with the previously sent Nonce
AAnd the received ciphertext
The signature is verified, if the signature passes the verification, the private key d of the user is used
AFor ciphertext
Decrypt and obtain Key
BMatch it with previously stored Key
APerforming XOR operation, if no Key is generated yet
AOne is generated immediately, and a corresponding New2 is created and sent to B, and finally the shared key of a and B is obtained as follows:
of course, if New1 of a neighbor is received but no New2 is received within a certain time, the New is discarded as a replay attack, and if New2 is received and no New1 is received within a certain time, New2 is also cleared from the queue.
In the method for establishing the sensor network authentication key based on the lightweight certificate, the used lightweight certificate is defined as:
in the method for establishing the sensor network authentication key based on the light certificate, the following four mechanisms are used in the negotiation process:
the challenge-response mechanism: because time synchronization in the sensor network is not easy, in order to resist replay attack, a random Nonce is used for constructing a challenge-response mechanism to resist replay attack;
a queue buffering mechanism: the queue buffer mechanism is used for solving the problems of unreliability of WSNs and time consumption of a public key mechanism, and each received packet is put into a circular queue for buffering, and similarly, the transmitted packet is also sent into another transmission queue for buffering; the queue buffer mechanism is utilized to realize the orderly receiving and transmitting of the New1 and the New 2;
a retransmission mechanism: in order to further solve the problem of high packet loss rate of WSNs and ensure successful establishment of a negotiation key, a parameterized retransmission mechanism is arranged to improve the successful establishment probability of the secure connection, and a MicaZ node simulation experiment in TinyOS shows that the retransmission value of 1 time is better;
invalid packet clearing mechanism: a timing cleaning mechanism is used to perform timing cleaning on the false registered neighbors and the received New2 packet without the corresponding New1 packet, so as to increase the opportunity of establishing session keys with the real neighbors.
In the method for establishing the sensor network authentication key based on the light certificate, two messages transmitted in the negotiation process are defined as follows:
New1:=NonceA||CertA,
an implementation apparatus of a sensor network authentication key establishment method based on a lightweight certificate is characterized in that, based on the authentication key establishment method defined in claim 1, an ECC primitive is used, and a relationship between a private key and a public key is defined as follows: q ═ dP; encryption/decryption is realized by using ECIES, and signature/signature verification is realized by using ECDSA; setting the number of New1 transmissions to 2, the key agreement process takes 1 minute at the TelosB node.
The invention separates the key establishing process of the authentication into two parts of public key authentication and key agreement data authentication by using the light certificate and the digital signature, so that each part of authentication packet does not exceed the regulation of the existing relevant standard, thereby being beneficial to the protocol to be implemented under the actual industrial standard. Meanwhile, in the key establishment method, a challenge-response mechanism is used for resisting replay attack, a queue buffer mechanism is used for improving reliability and solving the time-consuming problem of a public key mechanism, a retransmission mechanism is used for improving the proportion of establishing secure connection, an invalid packet cleaning mechanism is used for preventing buffer filling attack, the number of sent packets and the amount of each packet are reduced as far as possible in design, and the calculation amount is minimized under the condition of ensuring security by using ingenious ECIES and ECDSA primitive collocation, so that the method provided by the invention has the characteristics of high security, reliability, lower overhead and the like. In terms of security, as long as there are not the following three cases: the private keys of two parties are leaked at the same time, the secret values of the two parties are leaked at the same time, and the private key and the secret value of one party are leaked at the same time. Our subsequent embodiments show that when a retransmission mechanism is used to improve the secure connection rate, it is most cost effective to retransmit once.
Detailed Description
The technical scheme of the invention is further specifically described by the following embodiments and the accompanying drawings.
The authentication key establishment method provided by the invention comprises the following two stages:
stage one: pre-distribution of keys
This phase is implemented in two steps:
and step 1, initializing.
Assuming that the application scenario security requirement of the method is at the level of 80 bits, if we select the used public key primitive as ECC, the security parameter λ may be selected as 160.
Taking the curve as E: y is2=x3+ ax + b (a, b are constants, 4 a)3+27b2Not equal to 0), a large prime number p of lambda bits is selected, based on E/FpA cyclic abelian group G of order q (q is also a sufficiently large lambda-bit prime number) is constructed from which a generator P can be determined.
Selecting a proper hash function:
because the Hash function is only used for generating the message digest by using the compressibility of the signature, the Hash function with moderate security, such as SHA-1, can be selected.
The public parameter set of the construction system is as follows:
and selects the used ECC public key primitives as ECIES (encryption/decryption), ECDSA (signature/signature verification).
And 2, generating a public and private key pair and a certificate and loading the public and private key pair and the certificate into the node.
First of all a private/public key pair (d) is generated for the key generation center KGC
s,Q
s) Wherein
Q
s=d
sFor simplicity, the operations of modq and modp are omitted in this specification, and all the operations between point components require modp and all the operations between pre-point coefficients require modq. A private/public key pair is then generated by the KGC for each node (d)
i,Q
i) Is also taken
Q
i=d
iP, generating a lightweight certificate for it at the same time:
selectable compression mode
When compressed mode is used, Q
i[x]Except for storing Q
iBesides the x-coordinate of the point, a flag bit is also stored, and the non-compressed mode is preferable for the sensor network because the compressed mode requires a large amount of calculation when recovering the point.
Then the public key of KGC, the private/public key pair (d) of the nodei,Qi) The certificate, the used public key primitives, the Hash function and parameters related to these primitives are loaded into the node along with the application.
And a second stage: key establishment (as shown in FIG. 2)
(2a) After the sensor node loaded with the security material is deployed, the key agreement process shown in fig. 2 is started, and the nodes (such as a) participating in the agreement first create and broadcast a New1 packet:
New1:=NonceA||CertA。
(2b) when A receives a New1 package of a certain neighbor node (such as B), if A does not establish a shared key with B, the certificate Cert in the package is verified
BAfter the verification is passed, the node A stores the public key and the related information of the node B into a neighbor list. A will then generate a random Key
AIt is encrypted into with the public key of the other party
And with the received Nonce
BHash is combined, signed by the private key of A and
constructing a New2 packet to be sent to B, and recording the random Key Key
AEnter the record in which neighbor list B is located. Wherein the New2 packet structure is as follows:
(2c) when A receives a New2 packet of a neighbor node (such as B), if the A does not receive the New1 operation of B, the A is sent to a queue buffer, otherwise, the A is combined with the previously sent Nonce
AAnd the received ciphertext
The signature is verified, if the signature passes the verification, the private key d of the user is used
AFor ciphertext
Decrypt and obtain Key
BMatch it with previously stored Key
APerforming XOR operation (if the Key is not generated yet at this time)
AOne is generated immediately and a corresponding New2 is created and sent to B), and the shared key of a and B is finally obtained as:
if the signature verification fails, the New2 packet is discarded as a transmission error or attack.
Of course, if New1 of a neighbor is received but no New2 is received within a certain time, the New is discarded as a replay attack, and if New2 is received and no New1 is received within a certain time, New2 is also cleared from the queue.
Four mechanisms are adopted in the implementation:
the challenge-response mechanism: because time synchronization in the sensor network is not easy, in order to resist replay attack, a random Nonce is used in the method to construct a challenge-response mechanism to resist replay attack, and the specific implementation is shown in New1 and New2 packets.
A queue buffering mechanism: according to the method, a queue buffer mechanism is designed to solve the problems of unreliability of a sensor network, time consumption of a public key mechanism and the like, each received packet is placed into one circular queue for buffering, and similarly, a transmitted packet is also sent into the other transmission queue for buffering. The queue buffer mechanism is used for realizing the ordered transceiving of the New1 and the New 2.
A retransmission mechanism: in order to further solve the problem of high packet loss rate of a sensor network and ensure successful establishment of a negotiation key, a parameterized retransmission mechanism is arranged to improve the successful establishment probability of a secure connection, and a MicaZ node simulation experiment in TinyOS shows that a retransmission value of 1 time is preferred.
Invalid packet clearing mechanism: in the implementation of the method, a timing cleaning mechanism is used to perform timing cleaning on the false registered neighbor and the received New2 packet without the corresponding New1 packet, so as to increase the opportunity of establishing the session key with the real neighbor.
The four mechanisms are all embodied in the stage two, and the queue length, the retransmission times, the packet clearing delay and the like can be parameterized in implementation, so that the adjustment can be favorably carried out according to the actual platform and the safety and reliability requirements.
The method of the present invention is implemented on tinyos2.1.2 in the prior embodiment, and it is measured that a key agreement establishment process of one round of authentication takes about 66.5 seconds on TelosB, and the implementation main body structures of the stage one and the stage two are shown in fig. 3 and fig. 4, wherein NNM, ECCC, ECIES, ECDSA, and the like are all modules provided in tinyc 2.0, and tinpkg, testTinyAKE, and New1, New2, and the like among them are designed according to the above method, and the specific flow is similar to the above implementation process, and will not be described again.
The invention provides an authentication key establishment method suitable for a sensor network based on a light certificate mechanism, and solves the problem that the existing method cannot adapt to IEEE802.15.4 frame length limitation on the premise of ensuring safety by using ECIES, ECDSA and other primitives in a fine matching way. The method simultaneously considers the factor of high loss rate of sensor network packets which is not considered by the existing method, adds a retransmission negotiation packet mechanism to improve the proportion of establishing the safety connection, and optimally sets the effective retransmission times to 1 time through simulation experiments. The invention can be used for constructing a safer and more reliable basic environment for high-level data transmission and application of the sensor network.
The above embodiment is merely a specific example of the present invention, and does not constitute any limitation to the present invention. Various modifications or additions may be made or substituted in a similar manner to the described embodiments by those skilled in the art, while remaining within the scope of the invention as defined in the appended claims, e.g. by substituting ECC for future-appearing more efficient public key primitives.
Noun explanation and symbol explanation
The user: a legal session entity, a participant in a session in the network, or a message sender/receiver of a communication, which may be a process, a computer, a mobile terminal or a sensor node, etc.;
KGC: key Generation Center, which is responsible for generating system public parameter, main public/private Key pair, and each user's part public/private Key pair, and distributing public parameter and part public/private Key pair for each user;
ECC: eliptic Curve Cryptography, Elliptic Curve Cryptography, a theory for constructing Elliptic Curve Cryptography;
ECIES: an Elliptic Curve integrated encryption Scheme, an ECC primitive-based encryption/decryption Scheme;
ECDSA: an Elliptic Curve Digital Signature Algorithm, a Signature/Signature verification scheme based on ECC primitives;
(·)K: encrypting the content with a key K;
{·}K: signing the Hash value of the content with a key K;
λ: system safety parameters, which are selected by an application using the invention according to safety requirements, are at least not less than 160;
p, q: two large prime numbers selected by KGC to satisfy p ≥ 2λ-1;
Fp: finite field of order (number of elements) p;
g: q-order addition cycle group, which is based on E/F after selecting elliptic curve E by KGCpConstructing to obtain a generator P;
a set of positive integers less than q {1,2, …, q-1 };
H:
a cryptographic hash function;
mod: performing modulo remainder operation;
∈R: belongs to and is randomly selected;
scalar multiplication: operation of a point on a number-times elliptic curve
Point component: the x or y component of a point on the elliptical curve;
hash: cryptographic hash function operations, such as SHA-2 series of functions, etc.;
MAC: a message authentication code generation operation.