Monday, July 7, 2008

Security Aspects in Sensor Networks

What is wireless sensor network ?

Sensor network is a network consisting of spatially distributed devices that has limited resources in power, memory and energy. These devices called sensor motes (nodes) and they communicate each other when operating. These sensor motes communicate with base station that has many resources than sensor motes in power, memory and energy. This base station can communicate with sensor motes as well as out side world using internet or intranet facility. Sensor networks used to monitor physical or environmental conditions such as temperature, sound, vibration etc.


Why security is important in sensor networks?

Most of today's computer applications use information from their environment to produce some outputs. This information is gathered using sensor networks that are deployed in unsecure environment. Some of these applications are deployed in battle eld and perimeter defense that need high security concerns in their applications. So that security in sensor networks is more important in most of today's applications. These sensor networks face sensitive security concerns
including eavesdropping, fake of sensor data, denial of service attacks and physical compromise of sensor nodes. Most of security applications that are developed for wireless ad hoc networks are not suited for sensor networks, because of their limited resources in power, speed, memory etc.

Making secure sensor network is a challenge in some aspects. There are few concerns that can identify in secure sensor network.

1. Base station security
2. Authentication in sensor networks
3. Secure data communication among sensor nodes and base station
4. Security in sensor node storage
5. Strong Key management scheme

The Supervisor of this Literature Survey is Dr. Kasun De Zoysa, who is a information system security specialist.
You can have more information on here

Thursday, June 5, 2008

Show TIFF in JAVA

Java has very high capabilities in graphics than numerical computations. There are several classes to manipulate different image formats. The JPEG, GIF and PNG formats and directly manipulate using normal java.imageio library. But if u want to render some TIFF format images you should have another library called Java Advanced Imaging(JAI) API. It's very easy to use this library. Here are some examples.
You should install JAI for java in your machine or you should refer to the library in you project.

You should import javax.media.jai.* library to have following functions.

If you want to show a tiff stored in your local machine.
RenderedImage image = JAI.create("fileload", filename);

When you want to get a TIFF from server you can use following method.
RenderedImage image = JAI.create("url", u);
Here "u" is url to the tiff you refer. For example the url can be "http://www.kasun.com/mytest.tiff". There is a url class under java.net library.



Monday, January 21, 2008

Cryptography in JAVA

Cryptography is a very wide area in the computer technology. Most of new Information systems tend to have good security mechanisms withing the system. People use many languages to implement security in their information systems. One of the great language for security issues is the JAVA. The JAVA support many cryptographic algorithms and mechanisms withing its cryptographic library. Here I'll give some example to implement a encryption and decryption mechanism in your system.

To implement security you should have reference to the following libraries in your application.

import java.security.*;
import javax.crypto.*;

Then you have to create a cipher object.

Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");

Then you can generate a key for encryption using key generator in java cryptography.
KeyGenerator generator = KeyGenerator.getInstance("AES");
generator.init(128);
Key encryptionKey = generator.generateKey();

Here are some streams to read and write files.
FileInputStream fis = new FileInputStream("toencrypt.txt");
DataInputStream fdata=new DataInputStream(fis);
FileOutputStream fos = new FileOutputStream("encrypted.txt");

Start the encryption and read file and write encrypted to file.

cipher.init(Cipher.ENCRYPT_MODE,encryptionKey);
CipherOutputStream cOut = new CipherOutputStream(fos,cipher);
DataOutputStream dout = new DataOutputStream(cOut);

Byte s;
while ((s=fdata.readByte())!=null) {
dout.writeByte(s);
}

You should have save this key and IV used by this algorithm to decrypt the file.

Here I used AES as encryption algorithm and CBC (cipher block chaining mode) as the mode of algorithm.