ECC, TinySec, MiniSec & WSNs PDF Print E-mail
Written by martcon   
Monday, 19 January 2009 11:59

As mentioned in the previous blog entry, asymmetric key management systems are complex and not very practical for implementation within WSNs. However, there is one approach to asymmetric cryptography that should be considered. Elliptic Curve Cryptography (ECC) is an set of asymmetric algorithms encompassing key generation, encryption and decryption. Like other encryption algorithms it is a discrete logarithmic system which relies upon the difficulty of the discrete logarithm problem to prevent attempts to break the encryption of messages. However, unlike other systems, the security strength of ECC increases more rapidly as the length of the key is increased. ECC also has greater security at smaller key sizes compared to its symmetric equivalent.

An elliptic curve is defined using the following equation: y2 = x3 + ax + b. The graph using this equation is one or more sloping lines. We won't go into the mathematics of elliptic curves here (see http://www.deviceforge.com/articles/AT4234154468.html for a good overview of ECC) but we will cite the following advantages of ECC:

  • As mentioned previously, ECC offers more security for keys of a smaller size compared to other algorithms used for PKI systems.
  • The smaller key size makes it possible to offer better security in compact implementations i.e. mobile devices.

Considering this last point, given that ECC is effectively less demanding in its hardware requirements compared to other key management systems and is thus suitable for mobile systems one would expect it to have been considered for WSNs. This is indeed the case. Batina, Mentens,  Sakiyama, Preneel, and Verbauwhede have proposed a low-footprint low-power processor for ECC that would be suitable for WSNs. (See http://www.cosic.esat.kuleuven.be/publications/article-808.pdf for this paper.)  Blass and Zitterbart also present an implementation of WSN for sensor motes. Their code runs on the Atmels 8bit ATMEGA128 microcontroller. (See http://www.tm.uka.de/itm/WebMan/view.php?id=87&view=publikationen_detail for more details.)

There are also several implementations of ECC that are suitable for deployment in WSNs. Sun Research (http://research.sun.com/projects/crypto) have developed an implementation of ECC that is suitable for small sensors. TinyECC (http://discovery.csc.ncsu.edu/software/TinyECC/) provides a digital signature scheme, key exchange protocol and public key encryption scheme and can be deployed on sensors that run TinyOS. 

Another option for securing WSNs is TinySec (http://www.cs.berkeley.edu/~ckarlof/papers/tinysec-user-manual.pdf). TinySec provides a single key that is shared globally by the sensor network. It provides encryption at the link layer and integrity protection.TinySec also provides access control. However, TinySec cannot prevent denial of service attacks. Furthermore, it is also vulnerable to replay attacks (i.e. eaves dropping and replaying the message at a later time.).

Zigbee (http://www.zigbee.org), of course, also provides link layer encryption and provides superior security to TinySec but suffers from high energy consumption. MiniSec (http://sparrow.ece.cmu.edu/group/minisec.html ) aims to achieve the best of both protocols as it provides better security than TinySec and has much lower power consumption than Zigbee. 

WSNs are vulnerable to many types of security attacks ranging from sleep deprivation attacks preventing motes from going into low power mode and thus using up battery life to attacks causing collisions between packets in transmission. It is an important area to consider when deploying WSNs. Fortunately, techniques such as Identity Based Encryption (IBE)  and ECC as well as implementations such as MiniSec can assist in providing a secure and tamper proof network. 

 
Cryptography & WSNs PDF Print E-mail
Written by martcon   
Tuesday, 13 January 2009 16:13

Due to their resource constraints, security and cryptography is an open issue for WSNs. If we consider both symmetric and asymmetric key management systems we can see that the implementation of both these systems is not practical for WSNs.

Figure 1 ilustrates the operation of a Symmetric Key Management system. In essence, the sender tells the key manager who is receiving the data to be encrypted and an encryption key is set. The receiver of the encrypted data then authenticates that the data is coming from a valid sender via the key manager who in turn sends the decryption key so as to enable the data to be decrypted. The cardinal point to note here is that the same key is used to encrypt and decrypt the data. This is positive from a performance perspective and would seem to imply that a Symmetric Key Management system would be appropriate for a WSN. However, we also need to consider the fact that Symmetric Key Management systems require a database to store the generated keys. Furthermore, the key manager plays a role in every encryption and decryption operation. If we consider that one WSN may contain thousands or even tens of thousands of motes, each of which need to contact the key server, we can see how impractical Symmetric Key Management is for WSNs.

Symmetric Key Management

Figure 1: Symmetric Key Management System

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.

Public Key Infrastructure Key Management

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.

Identity Based Encryption

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.

Secure Email using IBE

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.

 
Common JNI Errors PDF Print E-mail
Written by martcon   
Monday, 05 January 2009 16:33

(Note: This post is principally relevant for MS Windows users.)

Vertoda doesn't use JNI directly but we have used it for other projects. In a nutshell, JNI (Java Native Interface) is a Java programming library that runs in the Java VM (Virtual Machine) and can call or be called by programs written for specific hardware or operating systems (referred to as native applications) as well as programs deployed as libraries and written in languages such as C and C++.

JNI is a very useful tool for accessing legacy code or libraries specific to a particular operating system. Device driver software is a good example as drivers for printers, monitors etc. are typically written for a specific operating system. Another example would be software for Serial COM ports. Data coming into acquisition boards for WSNs can be detected by a Java program listening on the Serial COM port to which the board is attached using the Java Communications API (http://java.sun.com/products/javacomm/). Given that Serial Port access is OS specific, this API uses JNI to access programs performing MS Windows specific functionality. A separate LINUX version is also available (http://www.agaveblue.org/howtos/Comm_How-To.shtml).

However, JNI can be frustrating to use initially. One must ensure that the paths to any libraries accessed are included. For example, let's say we're using a library called MyTest.dll and it's located in a directory called C:\MyDLLs. (A dynamic link library or DLL is a Microsoft Windows specific library.) Assume that we also have a Java JAR using JNI to access this DLL called MyJNITest.jar. We run the program using the following command:

java -Djava.library.path="C:\MyDLLs" -jar MyJNITest.jar

Note that we reference the path to the DLL in our -D runtime option but not the DLL file itself. If you don't specify this path you will get the following error:

java.lang.UnsatisfiedLinkError: no MyTest.dll in shared library path

Unfortunately, if our DLL depends on another DLL (say, MyOtherDLL.dll) then we will still get the following error:

java.lang.UnsatisfiedLinkError: "Can't Find Dependent Libraries"

This appears to be because JNI looks in the directory we specify for our java.library.path option but looks in the PATH environment variable for the directory location of DLLs on which our own DLL depends.

The first thing to do is find out what other DLLs our own DLL depends on. The easiest way to achieve this if you have Microsoft Visual Studio installed is the following:

  • Open a Command Line Window.
  • You will be using a file called dumpbin.exe. If you have Visual Studio installed this will be in C:\Program Files\Microsoft Visual Studio 8\VC\bin so cd to this directory.
  • Assuming our DLL is called MyTest.dll and is located in the C:\MyDLLs directory path we would run the following command:

             dumpbin.exe "C:\MyDLLs\MyTest.dll" /dependents

  • (Note that dumpbin.exe can be problematic on MS Vista. This will be the subject of another post.)
  • This will show what other libraries and DLLs our file depends on.

Let's assume we have one dependency called MyOtherDLL.dll located in a directory called C:\MyOtherDLLs. We can now add this directory to our path variable as follows:

  • On MS Vista click on the Windows button | Computer | System Properties to open the Control Panel.
  • Click on Advanced System Settings to open the System properties dialog and click on the Environment Variables pushbutton.
  • This opens the Environment Variables dialog window.
  • In the System Variables listbox select the PATH environment variable and click on the Edit pushbutton.
  • Assuming your dependency is located in C:\MyOtherDLLs add this to the path variable. Ensure that you postfix a semi-colon (;). Prefix a semi-colon (;) if it's the last entry.

You should now be able to run your JNI program.

 
Sun SPOTs PDF Print E-mail
Written by martcon   
Tuesday, 16 December 2008 15:22

Many commercial and academic organisations are involved in WSN development. Since Java runs on a myriad of devices from PC Servers to Blu Ray Players to Smart Phones it is only to be expected that Sun Microsystems would be one of these organisations. Sun SPOT (Small Programmable Object Technology) was launched in April 2007.  The most recent version is 4.0. The Sun SPOT project (see http://www.sunspotworld.com for more details) consists of a software development kit for programming Sun SPOT sensors and for taking readings into a PC. A typical Sun SPOT kit consists of two Sun SPOTs (a processor, sensor board, radio and battery) and a base station for connecting to a PC.

The motes communicate using the IEEE 802.15.4 standard and Zigbee can be run on top of the MAC layer.  Unlike other motes, Sun SPOTS have no operating system. Instead, they use a J2ME (Java Micro Edition) Virtual Machine (VM) called Squawk.

The clear advantage Sun SPOTs have over nesC programmable TinyOS based sensors is the familiarity and experience  many software engineers and IT professionals have with programming in Java. It is not a huge leap to move from programming for a Smart Phone or a J2EE (Java Enterprise Edition) application to programming a wireless sensor as the language is the same. By contrast,  nesC does represent a learning curve even for engineers who have substantial experience in programming in C and C++.

Another advantage the Sun SPOT project has over its nesC and TinyOS counterparts is the availability of an emulator that is easy to set up and use. This saves both time and money during WSN project development. There are certainly emulators available for TinyOS but none so convenient to use as the Sun SPOT equivalent. Emulators postpone the purchase of what can often be very expensive devices for those projects with constrained budgets.

One question regarding the use of Java with small devices like sensors would relate to speed. Given its use of a virtual machine, programs written in Java are slower than  their C and C++ equivalents so one may expect the same with Sun Spots compared with their nesC siblings. However, one must consider the fact that programmable sensors have quite limited functionality and that there is little anecdotal evidence or complaints about the speed of Sun SPOTS. It should also be noted that we are not dealing with a situation of a VM running over an operating system as the VM has device driver code to interact with the sensor hardware directly.

There is some evidence regarding an issue with battery life performance however. We have found that Sun SPOTs used in a project for monitoring motion had a battery life of approximately 7 hours. By contrast, TinyOS sensors have a battery life of up to 3 years. Further studies would be needed before we could draw any definitive conclusions.

Users will be able to use Sun SPOTs with Vertoda as we will be integrating a host application for reading data from these devices in a forthcoming edition of the system.

 
LinkedIn & Facebook PDF Print E-mail
Written by martcon   
Tuesday, 09 December 2008 18:09

There are now groups for Vertoda on LinkedIn (http://www.linkedin.com) and Facebook (http://www.facebook.com).

 
<< Start < Prev 11 12 13 14 15 16 17 18 19 Next > End >>

Page 16 of 19
RocketTheme Joomla Templates