Figure 2 illustrates the Public Key Infrastructure (PKI) Key Management system. The PKI system uses what are termed public key or asymmetric algorithms where the key used to decrypt data is different from the key used to encrypt the data. In this system, a public and private key are created simultaneously by a certifying authority (CA). The private key is given only to the requesting party (in Figure 2, the receiver) and the public key is made available as part of a digital certificate in a directory that all parties can access. The private key is never shared and cannot be accessed via the Internet. Thus, as per Figure 2, the sender accesses the public key from the central directory and encrypts the data using this key. The receiver then authenticates that the sender is a valid one from the CA and then decrypts the data with their private key.

Figure 2: Public Key Infrastructure Key Management
One advantage PKI systems have over their Symmetric Key counterparts is that there is no requirement for a key server to be contacted for each message sent. However, key recovery is difficult as the recipient generates the private keys him/herself. In addition a sender must locate a public key for every recipient and authenticate its validity - this is not always possible as the directory may not be able to supply public keys for all recipients. When we consider the ad-hoc nature of WSNs we can see that PKI needs to locate keys for every recipient mote or data acquisition board. Again we also need to consider the potential number of motes in a given network and the complexity of each encryption/decryption transaction that takes place under PKI.
It would appear then that both symmetric and asymmetric key management systems are inappropriate for WSNs. However, there is another possibility. In 2001, Dan Boneh and Matthew Franklin published a paper which outlines the successful implementation of Identity Based Encryption (IBE). (See http://crypto.stanford.edu/~dabo/papers/bfibe.pdf for this document.) In essence a sender of a message can encrypt a message using the receiver's ID (for example, an email address) as public key.
Figure 3 illustrates the operation of an Identity Based Encryption (IBE) system. The encryption key is derived mathematically from the receiver's identity. Thus when the sender specifies the identity of the receiver(s) an encryption key is derived. The data is then encrypted and sent to the receiver who authenticates the data with a key server. Once authenticated, the key server sends the decryption key to the receiver and the data can be decrypted.
With IBE the sender does not need to contact the key server at all while the receiver only needs to contact the key server once to authenticate and receive the decryption key. The is no need for a key database as the server can construct the receiver's decryption key mathematically.
Encrypting information is also straightforward as the sender can dictate which key server can be used to protect data. The location of the key server can be in the sender's or receiver's organisation or indeed can be managed by a third party.

Figure 3: Identity Based Encryption
Figure 4 illustrates how a secure email is sent using IBE. Assuming we have a sender User 1 who sends a secure email to a recipient User 2, the latter's email address being user2@company.com, the following steps take place:
1. User 1 encrypts the email using User 2's email address (user2@company.com) as the public key.
2. When User 2 receives the message he/she contacts the key server. The key server contacts a directory or other external authentication source to authenticate User 2's identity.
3. After authenticating User 2, the key server then returns his/her private key, with which User 2 can decrypt the message. This private key can be used to decrypt all future messages received by User 2.
Private keys only need to be generated once, upon initial receipt of an encrypted message. All subsequent communications corresponding to the same public key can be decrypted using the same private key, even if the user is offline.

Figure 4: Secure Email using IBE
Because of its architecture, Identity Based Encryption would appear to be a potential candidate for encrypting WSN data. Indeed, this has been proposed by Leonardo Oliveira, Diego Aranha, Eduardo Morais, Felipe Daguano, Julio Lopez and Ricardo Dahab in their academic paper on Identity Based Encryption for Sensor Networks. (See http://eprint.iacr.org/2007/020.pdf for this document.) The authors argue that IBE and WSNs are complementary systems and demonstrate how keys can be distributed among sensor nodes. Key distribution is a critical issue for WSNs as we want to prevent unauthorised nodes joining a WSN while admitting legitimate nodes in a timely fashion.
Security is an important issue for WSNs. Possible security attacks include denial of service (DOS) attacks, private attacks, listening to and analysing WSN traffic and the alteration and/or replication of node configurations.Given that it is envisaged that WSNs will play a major role in security applications it is imperative that the nodes themselves be secured. It is agreed by many researchers that IBE could play an important role in data encryption for WSNs.
There are of course other techniques and implementations to be considered for securing WSNs. In a future blog we will explore TinySec and the possibility of using Elliptic Curve Cryptography (ECC) in WSNs.