Top Banner
B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 1 INTRODUCTION Wireless sensor networks (WSNs) have been widely deployed for various applications, such as environment sensing, building safety monitoring, earthquake prediction, etc. Consider a two- tiered sensor network architecture in which storage nodes gather data from nearby sensors and answer queries from the sink of the network. The storage nodes serve as an intermediate tier between the sensors and the sink for storing data and processing queries. Storage nodes bring three main benefits to sensor networks. First, sensors save power by sending all collected data to their closest storage node instead of sending them to the sink through long routes. Second, sensors can be memory-limited because data are mainly stored on storage nodes. Third, query processing becomes more efficient because the sink only communicates with storage nodes for queries. The inclusion of storage nodes in sensor networks was first introduced in and has been widely adopted Several products of storage nodes, such as StarGate and RISE are commercially available. However, the inclusion of storage nodes also brings significant security challenges. As storage nodes store data received from sensors and serve as an important role for answering queries, they are more vulnerable to be compromised, especially in a hostile environment. A compromised storage node imposes significant threats to a sensor network. First, the attacker may obtain sensitive data that has been, or will be, stored in the storage node. Second, SCETW BE IV Year II Sem IT-Dept
70

Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

Nov 08, 2014

Download

Documents

San Geetha B C
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 1

INTRODUCTION

Wireless sensor networks (WSNs) have been widely deployed for various applications, such

as environment sensing, building safety monitoring, earthquake prediction, etc. Consider a

two-tiered sensor network architecture in which storage nodes gather data from nearby

sensors and answer queries from the sink of the network. The storage nodes serve as an

intermediate tier between the sensors and the sink for storing data and processing queries.

Storage nodes bring three main benefits to sensor networks. First, sensors save power by

sending all collected data to their closest storage node instead of sending them to the sink

through long routes. Second, sensors can be memory-limited because data are mainly stored

on storage nodes. Third, query processing becomes more efficient because the sink only

communicates with storage nodes for queries. The inclusion of storage nodes in sensor

networks was first introduced in and has been widely adopted Several products of storage

nodes, such as StarGate and RISE are commercially available. However, the inclusion of

storage nodes also brings significant security challenges. As storage nodes store data

received from sensors and serve as an important role for answering queries, they are more

vulnerable to be compromised, especially in a hostile environment. A compromised storage

node imposes significant threats to a sensor network. First, the attacker may obtain sensitive

data that has been, or will be, stored in the storage node. Second, the compromised storage

node may return forged data for a query. Third, this storage node may not include all data

items that satisfy the query.

To design a protocol that prevents attackers from gaining information from both sensor

collected data and sink issued queries, which typically can be modeled as range queries, and

allows the sink to detect compromised storage nodes when they misbehave. For privacy,

compromising a storage node should not allow the attacker to obtain the sensitive

information that has been, and will be, stored in the node, as well as the queries that the

storage node has received, and will receive. Note that we treat the queries from the sink as

confidential because such queries may leak critical information about query issuers’ interests,

which need to be protected especially in military applications. For integrity, the sink needs to

detect whether a query result from a storage node includes forged data items or does not

include all the data that satisfy the query. There are two key challenges in solving the privacy

SCETW BE IV Year II Sem IT-Dept

Page 2: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 2

and integrity-preserving range query problem. First, a storage node needs to correctly process

encoded queries over encoded data without knowing their actual values. Second, a sink needs

to verify that the result of a query contains all the data items that satisfy the query and does

not contain any forged data.

1.1 Existing System

Existing Wireless sensor networks once sensor nodes have been deployed, there will be minimal

manual intervention and monitoring. But, when nodes are deployed in a hostile environment and there

is no manual monitoring.

1.2 Proposed System

In the existing system there are few drawbacks such as, the existing system is not suitable for

giving privacy for each and every nodes. These drawbacks are eliminated in the following

proposed system.

The proposed a scheme to preserve the privacy and integrity of range queries in sensor

networks .This scheme uses the bucket-partitioning for database privacy. The basic idea is to

divide the domain of data values into multiple buckets, the size of which is computed based

on the distribution of data values and the location of sensors. In each time-slot, a sensor

collects data items from the environment, places them into buckets, encrypts them together in

each bucket, and then sends each encrypted bucket along with its bucket ID to a nearby

storage node. For each bucket that has no data items, the sensor sends an encoding number,

which can be used by the sink to verify that the bucket is empty, to a nearby storage node.

When the sink wants to perform a range query, it finds the smallest set of bucket IDs that

contains the range in the query, then sends the set as the query to storage nodes. Upon

receiving the bucket IDs, the storage node returns the corresponding encrypted data in all

those buckets. SafeQ also allows a sink to detect compromised storage nodes when they

misbehave. The sink is the point of contact for users of the sensor network. Each time the

sink receives a question from a user, it first translates the question into multiple queries and

then disseminates the queries to the corresponding storage nodes, which process the queries

based on their data and return the query results to the sink.

SCETW BE IV Year II Sem IT-Dept

Page 3: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 3

1.3Modules

In the proposed system the following modules are considered:

1. SafeQ

2. Integrity

3. Privacy

4. Range Queries

5. Sink

6. Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 4: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 4

SYSTEM REQUIREMENTS

2.1 Software Requirements

System : Pentium IV 2.4 GHz.

Hard Disk : 40 GB.

Floppy Drive : 1.44 Mb.

Monitor : 15 VGA Colour.

Mouse : Logitech.

Ram : 256 Mb.

2.2 Hardware Requirements

Operating System : Windows XP professional

Front End : JAVA, RMI,Swing(JFC)

Back End : MS-Access

SCETW BE IV Year II Sem IT-Dept

Page 5: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 5

ANALYSIS AND DESIGN

3.1 Module Description

3.1.1 SafeQ Module:

SafeQ is a protocol that prevents attackers from gaining information from both sensor

collected data and sink issued queries. SafeQ also allows a sink to detect compromised

storage nodes when they misbehave. To preserve privacy, SafeQ uses a novel technique to

encode both data and queries such that a storage node can correctly process encoded queries

over encoded data without knowing their values.

3.1.2 Integrity Module:

The sink needs to detect whether a query result from a storage node includes forged

data items or does not include all the data that satisfy the query. There are two key challenges

in solving the privacy and integrity-preserving range query problem. First, a storage node

needs to correctly process encoded queries over encoded data without knowing their actual

values. Second, a sink needs to verify that the result of a query contains all the data items that

satisfy the query and does not contain any forged data.

3.1.3 Privacy Module:

Both simulations and analysis show that the relay load over the network, imposed by straight

line routing, depends on the model of the traffic pattern. Even if the system settings are

identical and straight line routing is commonly adopted, the relay load induced by “random”

traffic could be distributed differently over the network. This paradoxical result is a

consequence of the famous Bertrand’s paradox. Thus, in contrast to traditional belief, there

are many scenarios in which straight line routing itself can balance the load over the network,

and in such cases explicit load-balanced routing may not help mitigate the relaying load.

3.1.4 Range Queries Module

Analyze the load for a homogeneous multi-hop wireless network for the case of straight line

routing in shortest path routing is frequently approximated to straight line routing in large

multi-hop wireless networks. Since geographical and geometric attributes of nodes and routes

SCETW BE IV Year II Sem IT-Dept

Page 6: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 6

affect the nodal load, we employ results from geometric probabilities to solve the problem.

Based on our analytical results, we are able to show the precise relationship between the

number of nodes and the load at each node, and the geographical distribution of the relaying

load over the network for different scenarios. Interestingly, straight line routing itself can

balance the relay load over the disk in certain cases.

3.1.5 Sink Module:

The sink is the point of contact for users of the sensor network. Each time the sink receives a

question from a user, it first translates the question into multiple queries and then

disseminates the queries to the corresponding storage nodes, which process the queries based

on their data and return the query results to the sink. The sink unifies the query results from

multiple storage nodes into the final answer and sends it back to the user. sink can detect

compromised storage nodes when they misbehave.

3.1.6 Storage node Module

Storage nodes are powerful wireless devices that are equipped with much more storage

capacity and computing power than sensors.The storage node collects all data from the

sensor nodes. The storage node can’t view the actual value of sensor node data. If the storage

node trying to view the sensor node data, sink detect misbehave of storage node.

3.2 System Design

Based on the user requirements and the detailed analysis of the existing system, the new

system must be designed. This is the phase of system designing. It is the most crucial phase

in the developments of a system. The logical system design arrived at as a result of systems

analysis is converted into physical system design. Normally, the design proceeds in two

stages:

1. Preliminary or General Design

2. Structured or Detailed Design

Preliminary or General Design: In the preliminary or general design, the features of the

new system are specified. The costs of implementing these features and the benefits to be

SCETW BE IV Year II Sem IT-Dept

Page 7: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 7

derived are estimated. If the project is still considered to be feasible, we move to the detailed

design stage.

Structured or Detailed Design: In the detailed design stage, computer oriented work begins

in earnest. At this stage, the design of the system becomes more structured. Structure design

is a blue print of a computer system solution to a given problem having the same components

and inter-relationships among the same components as the original problem. Input, output,

databases, forms, codification schemes and processing specifications are drawn up in detail.

In the design stage, the programming language and the hardware and software platform in

which the new system will run are also decided.

3.3 UML Diagrams for Privacy and Integrity Preserving Range Queries In Sensor

Networks

Unified Modeling Language is a graphical visualization language. It consists of a series of

symbols and connectors that can be used to create process diagrams and is often used to

model computer programs and workflows.

3.3.1 Use Case Diagram for Privacy and Integrity Preserving Range Queries

In Sensor Networks

A use case diagram in unified Modeling Language (UML) is a type of behavioral diagram

defined by and created from a Use-case Analysis. Its purpose is to present a graphical

overview of the functionality provided by a system in terms of actors, their goals

(represented as use cases), and any dependencies between those use cases. The main purpose

of use case diagram is to show what system functions are performed for which actor. Roles

of the actors in the system can be depicted. Use Case diagrams are formally included in two

modeling languages defined by the OMG(Object Management Group) the Unified Modeling

Language(UML) and the System Modeling Language(SysML). The Use case diagram for

Privacy and Integrity Preserving Range Queries In Sensor Networks is shown in the Figure

3.1.

SCETW BE IV Year II Sem IT-Dept

Page 8: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 8

The purposes of use case diagrams can be as follows:

1. Used to gather requirements of a system.

2. Used to get an outside view of a system.

3. Identify external and internal factors influencing the system.

4. Show the interacting among the requirements are actors.

Sensor

Storage node

Sink

Send file

View file name

View File details

View filename

View filedetails

View misbehavior details

Send query request

Response to Request

Receive file

Figure 3.1: Use Case Diagram for Privacy and Integrity Preserving Range Queries in Sensor

networks.

SCETW BE IV Year II Sem IT-Dept

Page 9: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 9

3.3.2 Class Diagram for Privacy and Integrity Preserving Range Queries in Sensor

networks:

Class diagrams are widely used to describe the types of objects in a system and their

relationships. Class diagrams model class structure and contents using design elements such

as classes, packages and objects. Class diagrams describe three different perspectives when

designing a system, conceptual, specification, and implementation. These perspectives

become evident as the diagram is created and help solidify the design. This example is only

meant as an introduction to the UML and class diagrams. Classes are composed of three

things: a name, attributes, and operations. The Class diagram for Privacy and Integrity

Preserving Range Queries In Sensor Networks is shown in the Figure 3.2.

The purpose of the class diagram can be summarized as:

1. Analysis and design of the static view of an application.

2. Describe responsibilities of a system.

3. Base for component and deployment diagrams.

4. Forward and reverse engineering.

SCETW BE IV Year II Sem IT-Dept

Page 10: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 10

Figure 3.2: Class Diagram for Privacy and Integrity Preserving Range Queries in Sensor

networks

SCETW BE IV Year II Sem IT-Dept

Page 11: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 11

3.3.3 Sequence Diagram for Privacy and Integrity Preserving Range Queries in Sensor

Networks:

A sequence diagram in a Unified Modeling Language (UML) is a kind of interaction

diagram that shows how processes operate with one another and in what order. It is

a construct of a Message Sequence Chart. A sequence diagram shows object interactions

arranged in time sequence. It depicts the objects and classes involved in the scenario and the

sequence of messages exchanged between the objects. A sequence diagram shows, as parallel

vertical lines (lifelines), different processes or objects that live simultaneously, and, as

horizontal arrows, the messages exchanged between them, in the order in which they

occur. The Sequence Diagram for Privacy and Integrity Preserving Range Queries in Sensor

Networks is shown in the Figure 3.3.

Sensor node Storage node Sink

Data base

1 : View avaialable file()2 : Send file()

3 : View file details()

4 : View misbehavior details()

5 : Send request()

6 : Receive file()

Figure 3.3: Sequence Diagram for Privacy and Integrity Preserving Range Queries in Sensor

Networks

SCETW BE IV Year II Sem IT-Dept

Page 12: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 12

3.3.4 Activity Diagram for Privacy and Integrity Preserving Range Queries in Sensor

Networks:

Activity diagram is another important diagram in UML to describe dynamic aspects of the

system.Activity diagram is basically a flow chart to represent the flow form one activity to

another activity. The activity can be described as an operation of the system. The Activity

diagram for Cut Detection in WSN’s is shown in the figure 3.4.

The purposes can be described as:

1. Draw the activity flow of a system.

2. Describe the sequence from one activity to another.

3. Describe the parallel, branched and concurrent flow of the system.

SCETW BE IV Year II Sem IT-Dept

Page 13: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 13

Figure 3.4: Activity Diagram for Privacy and Integrity Preserving Range Queries in Sensor

Networks

CODING AND TESTING

Implementation is the stage of the project when the theoretical design is turned out into a

working system. Thus it can be considered to be the most critical stage in achieving a

SCETW BE IV Year II Sem IT-Dept

Page 14: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 14

successful new system and in giving the user, confidence that the new system will work and

be effective.

4.1 Technology:

4.1.1 JAVA:

Java technology is both a programming language and a platform. The Java programming

language is a high-level language that can be characterized as Simple, Architecture neutral,

Object oriented, Portable, Distributed, High performance, Interpreted, Multithreaded, Robust,

Dynamic, Secure.

With most programming languages, you either compile or interpret a program so that you can

run it on your computer. The Java programming language is unusual in that a program is both

compiled and interpreted. With the compiler, first you translate a program into an

intermediate language called Java byte codes —the platform-independent codes interpreted

by the interpreter on the Java platform. The interpreter parses and runs each Java byte code

instruction on the computer. Compilation happens just once; interpretation occurs each time

the program is executed. The following figure illustrates how this works.

Figure 4.1: Working of Java Technology

4.1.2 RMI:

Java Remote Method Invocation is a mechanism that allows the development of distributed

java applications. Using RMI a java application can call methods of a remote object on a

SCETW BE IV Year II Sem IT-Dept

Page 15: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 15

different Java Virtual Machine (JVM). RMI is supplied as part of Sun Micro system’s Java

Development Kit (JDK).

RMI is implemented as three layers:

1. A stub program in the client side of the client/server relationship, and a corresponding

skeleton at the server end. The stub appears to the calling program to be the program

being called for a service.

2. A Remote Reference Layer that can behave differently depending on the parameters

passed by the calling program. For example, this layer can determine whether the

request is to call a single remote service or multiple remote programs as in a

multicast.

3. A Transport Connection Layer, which sets up and manages the request.

4.2 Code:

ADMIN:

import javax.swing.*;

import java.awt.*;

import java.awt.event.*;

import java.io.*;

import java.net.*;

import java.util.*;

import javax.swing.event.*;

import java.sql.*;

import java.rmi.*;

public class login extends JFrame implements ActionListener

SCETW BE IV Year II Sem IT-Dept

Page 16: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 16

{

JLabel fname;

JLabel file;

JLabel packet;

JLabel title,title1;

JLabel n1,n2;

JButton open;

JButton send;

JButton reset;

JTextField fname1;

JPasswordField file1;

JTextArea packet1;

String msg=""

Container c;

ImageIcon ii;

ImageIcon i2;

Socket c1;

public login()

{

initializeComponent();

}

SCETW BE IV Year II Sem IT-Dept

Page 17: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 17

private void initializeComponent()

{

fname=new JLabel("<html><font color=#FFFFFF size=+1><strong>User

Name</strong></font>");

file=new JLabel("<html><font color=#FFFFFF

size=+1><strong>Password</strong></font>");

title=new JLabel("<html><font color=#FFFFFF size=+2><strong>ADMIN LOGIN

</strong></font>")

JLabel imageLabel1 = new JLabel();

ImageIcon v1 = new ImageIcon(this.getClass().getResource(""));

imageLabel1.setIcon(v1);

send=new JButton("Send");

send.addActionListener(this);

fname1=new JTextField(10);

file1=new JPasswordField(10);

c=getContentPane();

c.setLayout(null);

c.add(fname);

c.add(file);

c.add(imageLabel1);

c.add(title);

c.add(send);

SCETW BE IV Year II Sem IT-Dept

Page 18: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 18

c.add(fname1);

c.add(file1);

c.setBackground(new java.awt.Color(100,90,150));

c.setLocation(300,300);

title.setBounds(75,30,700,50);

imageLabel1.setBounds(450,100,350,250);

fname.setBounds(30,100,250,25);

file.setBounds(30,150,250,25);

send.setBounds(150,215,75,25);

fname1.setBounds(150,100,150,25);

file1.setBounds(150,150,150,25);

setSize(350,300);

setVisible(true);

setTitle("Admin Login");

}

public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==send)

{

if(fname1.getText().equals(""))

{

SCETW BE IV Year II Sem IT-Dept

Page 19: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 19

JOptionPane.showMessageDialog(null,"Enter UserName");

fname1.requestFocus();

}

else if(file1.getText().equals(""))

{

JOptionPane.showMessageDialog(null,"Password");

file1.requestFocus();

}

else

if((fname1.getText().equals("chennaisunday"))&&(file1.getText().equals("chennaisunday")))

{

new sink();

this.dispose();

}

else

JOptionPane.showMessageDialog(null,"Invalid UserName and Password");

fname1.requestFocus();

}

}

}

public static void main(String args[])

SCETW BE IV Year II Sem IT-Dept

Page 20: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 20

{

new login();

}

}

Sensor Node1:

import javax.swing.*;

import java.awt.*;

SCETW BE IV Year II Sem IT-Dept

Page 21: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 21

import java.awt.event.*;

import java.io.*;

import java.net.*;

import java.util.*;

import javax.swing.event.*;

import java.sql.*;

import java.rmi.*;

public class sensornode1 extends JFrame implements ActionListener

{

String filesel,s1,s2,mst;

String[] pmes;

String[] str1=new String[10];

Random r;

File f;

JLabel fname;

JLabel file;

JLabel packet;

JLabel title,title1;

JLabel n1;

JButton open;

JButton send;

SCETW BE IV Year II Sem IT-Dept

Page 22: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 22

JButton reset;

JTextField fname1;

JTextField file1;

JTextArea packet1;

String msg="";

Container c;

ImageIcon ii;

ImageIcon i2;

Socket c1;

public sensornode1()

{

initializeComponent();

}

private void initializeComponent()

{

fname=new JLabel("<html><font color=#FFFFFF

size=+1><strong>FileName</strong></font>");

file=new JLabel("<html><font color=#FFFFFF size=+1><strong>File</strong></font>");

packet=new JLabel("<html><font color=#FFFFFF size=+1><strong>Packet

Sending</strong></font>");

title=new JLabel("<html><font color=#FFFFFF size=+2><strong>Privacy- and Integrity-

Preserving Range Queries in </strong></font>");

SCETW BE IV Year II Sem IT-Dept

Page 23: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 23

title1=new JLabel("<html><font color=#FFFFFF size=+2><strong>Sensor

Networks</strong></font>");

n1=new JLabel("<html><font color=#FFFFFF size=+1><strong>Sensor

Node1</strong></font>");

JLabel imageLabel1 = new JLabel();

ImageIcon v1 = new ImageIcon(this.getClass().getResource("AnimatedTower.gif"));

imageLabel1.setIcon(v1);

open=new JButton("Open");

open.addActionListener(this);

send=new JButton("Send");

send.addActionListener(this);

fname1=new JTextField(10);

file1=new JTextField(10);

packet1=new JTextArea();

c=getContentPane();

c.setLayout(null);

c.add(fname);

c.add(file);

c.add(packet);

c.add(packet1);

c.add(n1);

c.add(imageLabel1);

SCETW BE IV Year II Sem IT-Dept

Page 24: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 24

c.add(title);

c.add(title1);

c.add(open);

c.add(send);

c.add(fname1);

c.add(file1);

c.setBackground(new java.awt.Color(100,90,200));

c.setLocation(300,300);

title.setBounds(75,30,700,50);

title1.setBounds(300,60,300,50);

imageLabel1.setBounds(475,125,450,350);

fname.setBounds(30,150,250,25);

file.setBounds(30,200,250,25);

packet.setBounds(150,300,200,25);

packet1.setBounds(150,350,150,150);

n1.setBounds(475,375,150,100);

open.setBounds(255,200,75,25);

send.setBounds(150,245,75,25);

fname1.setBounds(150,150,150,25);

file1.setBounds(150,200,100,25);

SCETW BE IV Year II Sem IT-Dept

Page 25: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 25

setSize(800,600);

setVisible(true);

setTitle("Sensor Node1");

}

public void actionPerformed(ActionEvent ae)

{

if(ae.getSource()==send)

{

if(fname1.getText().equals(""))

{

JOptionPane.showMessageDialog(null,"Enter File Name");

fname1.requestFocus();

}

else if(file1.getText().equals(""))

{

JOptionPane.showMessageDialog(null,"Browse File");

file1.requestFocus();

}

else

{

SCETW BE IV Year II Sem IT-Dept

Page 26: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 26

System.out.println("Connected To StorageNode....");

System.out.println("\n");

String nm="sensornode1";

String fn =fname1.getText();

f=new File(filesel);

String st;

try

{

String url = "rmi://127.0.0.1/storagenode";

srvint in = (srvint) Naming.lookup(url);

int sz;

byte[] buffer;

pmes=new String[10];

r =new Random();

FileInputStream fin=new FileInputStream(filesel);

sz=fin.available()/7;

buffer=new byte[sz];

int m=r.nextInt(7);

StringBuffer sb=new StringBuffer();

for(int i=0;i<=7;i++)

SCETW BE IV Year II Sem IT-Dept

Page 27: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 27

{

fin.read(buffer);

st=new String(buffer);

pmes[i]=st;

sb.append(st);

}

String pt=packet1.getText();

String pt1="null";

if(pt!=pt1)

{

packet1.setText("");

}

System.out.println("File Sending From Sensornode1 to Storagenode");

System.out.println("\n");

System.out.println("Filename:\t"+fn);

System.out.println("\n");

for(int i=0;i<=7;i++)

{

if(i!=m)

{

SCETW BE IV Year II Sem IT-Dept

Page 28: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 28

packet1.append("Packet["+i+"]:PACK");

packet1.append("\n");

new cc1(i,m);

}

else

{

packet1.append("Packet["+i+"]:NACK");

packet1.append("\n");

new cc1(i,m);

}

}

System.out.println("\n \t Packet["+m+"]:Positive ACK" );

System.out.println("\n File Sent To Storagenode" );

packet1.append("Packet["+m+"]:PACK");

in.getfile(nm,fn,sb);

file1.setText("");

fname1.setText("");

}

catch(Exception e)

{

}

SCETW BE IV Year II Sem IT-Dept

Page 29: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 29

}

}

if(ae.getSource()==open)

{

FileDialog fd1=new FileDialog(this,"OPEN",FileDialog.LOAD);

fd1.setVisible(true);

filesel=fd1.getDirectory()+fd1.getFile();

file1.setText(filesel);

}

}

public static void main(String args[])

{

new sensornode1();

System.out.println("Sensornode1 Started....");

}

}

class cc1 extends Thread

{

Thread t;

cc1(int ps,int rm)

{

SCETW BE IV Year II Sem IT-Dept

Page 30: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 30

try

{

if(rm!=ps)

{

System.out.println("\t Packet["+ps+"]:Positive ACK");

System.out.println("\n");

t.sleep(2000);

}

else

{

System.out.println("Packet["+ps+"]:Negative ACK");

System.out.println("\n");

}

}

catch(Exception e)

{

System.out.println(e);

}

}

}

Code similar for other nodes.

SCETW BE IV Year II Sem IT-Dept

Page 31: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 31

4.3 System Testing:

The purpose of testing is to discover errors. Testing is the process of trying to discover every

conceivable fault or weakness in a work product. It provides a way to check the functionality

of components, sub assemblies, assemblies and/or a finished product. It is the process of

exercising software with the intent of ensuring that the software system meets its

requirements and user expectations and does not fail in an unacceptable manner. There are

various types of test. Each test type addresses a specific testing requirement.

Types of testing are Integration Testing, Functional Testing, System Testing, White Box

Testing, Black Box Testing.

4.3.1 Unit Testing:

Unit testing is usually conducted as part of a combined code and unit test phase of the

software lifecycle, although it is not uncommon for coding and unit testing to be conducted

as two distinct phases.

Test Strategy and Approach

Field testing will be performed manually and functional tests will be written in detail.

Test Objectives

1. All field entries must work properly.

2. Pages must be activated from the identified link.

3. The entry screen, messages and responses must not be delayed.

Features to be tested

1. Verify that the entries are of the correct format

2. No duplicate entries should be allowed

3. All links should take the user to the correct page.

4.4 Test Cases for Privacy and Integrity Preserving Range Queries in Sensor Networks:

SCETW BE IV Year II Sem IT-Dept

Page 32: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 32

Figure 5.1 Storage Node: Where the files are stored.

SCETW BE IV Year II Sem IT-Dept

Page 33: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 33

Figure 5.2 Sensor Node1: The files are sent from Sensor Node1 to Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 34: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 34

Figure 5.3 Sensor Node 2: The files are sent from sent from Sensor Node1 to Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 35: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 35

Figure 5.4 Sensor Node 3: The files are sent sent from Sensor Node3 to Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 36: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 36

Figure 5.5 Packets are sent from Sensor Node1 to Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 37: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 37

Figure 5.6 The file is received from Sensor Node1 by Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 38: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 38

Figure 5.7: Packets are sent from Sensor Node2 to Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 39: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 39

Figure 5.8: The file is received from Sensor Node2 by Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 40: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 40

Figure 5.9: Packets are sent from Sensor Node3 to Storage Node

SCETW BE IV Year II Sem IT-Dept

Page 41: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 41

Figure 5.10: File received at Sink

SCETW BE IV Year II Sem IT-Dept

Page 42: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 42

Figure 5.11: Sink Viewing File ID, File Name, File Received.

SCETW BE IV Year II Sem IT-Dept

Page 43: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 43

Figure 5.12: Sink Viewing information from the file.

SCETW BE IV Year II Sem IT-Dept

Page 44: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 44

Figure 5.13: Sink cannot view the information as Encryption Algorithm is used.

SCETW BE IV Year II Sem IT-Dept

Page 45: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 45

Figure 5.14: Sink detects the misbehavior details.

SCETW BE IV Year II Sem IT-Dept

Page 46: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 46

Figure 5.15: File saved at the desired destination

Figure 5.16: File saved as Notepad

SCETW BE IV Year II Sem IT-Dept

Page 47: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 47

CONCLUSION

6.1 Conclusion

SafeQ, a novel and efficient protocol for handling range queries in two-tiered sensor

networks in a privacy- and integrity- preserving fashion. SafeQ uses the techniques of prefix

membership verification, Merkle hash trees, and neighborhood chaining. In terms of

security, SafeQ significantly strengthens the security of two-tiered sensor networks. Unlike

prior art, SafeQ prevents a compromised storage node from obtaining a reasonable estimation

on the actual values of sensor collected data items and sink issued queries. In terms of

efficiency, our results show that SafeQ significantly outperforms prior art for

multidimensional data in terms of both power consumption and storage space. Second, we

propose an optimization technique using Bloom filters to significantly reduce the

communication cost between sensors and storage nodes. Third, a solution to adapt SafeQ for

event-driven sensor networks.

SCETW BE IV Year II Sem IT-Dept

Page 48: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 48

REFERENCES

[1] F. Chen and A. X. Liu, “SafeQ: Secure and efficient query processing in sensor networks,”

in Proc. IEEE INFOCOM, 2010, pp. 1–9.

[2] S. Ratnasamy, B. Karp, S. Shenker, D. Estrin, R. Govindan, L. Yin, and F. Yu, “Data-

centric storage in sensornets with GHT, a geographic hash table,” Mobile Netw. Appl., vol. 8,

no. 4, pp. 427–442, 2003.

[3] P. Desnoyers, D. Ganesan, H. Li, and P. Shenoy, “Presto:A predictive storage

architecture for sensor networks,” in Proc. HotOS, 2005, p. 23.

[4] D. Zeinalipour-Yazti, S. Lin, V. Kalogeraki, D. Gunopulos, and W. A. Najjar,

“Microhash: An efficient index structure for flash-based sensor devices,” in Proc. FAST,

2005, pp. 31–44.

[5] B. Sheng, Q. Li, and W. Mao, “Data storage placement in sensor networks,” in Proc.

ACM MobiHoc, 2006, pp. 344–355.

[6] B. Sheng, C. C. Tan, Q. Li, and W. Mao, “An approximation algorithm for data storage

placement in sensor networks,” in Proc. WASA, 2007, pp. 71–78.

[7] B. Sheng and Q. Li, “Verifiable privacy-preserving range query in twotiered sensor

networks,” in Proc. IEEE INFOCOM, 2008, pp. 46–50.

[8] Xbow, “Stargate gateway (spb400),” 2011 [Online]. Available: http://

www.xbow.com

[9] W. A. Najjar, A. Banerjee, and A. Mitra, “RISE:More powerful, energy efficient,

gigabyte scale storage high performance sensors,” 2005 [Online]. Available:

http://www.cs.ucr.edu/~rise

[10] S. Madden, “Intel lab data,” 2004 [Online]. Available: http://berkeley. Intel

research.net/labdata

SCETW BE IV Year II Sem IT-Dept

Page 49: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 49

[11] J. Shi, R. Zhang, and Y. Zhang, “Secure range queries in tiered sensor networks,” in

Proc. IEEE INFOCOM, 2009, pp. 945–953.

[12] R. Zhang, J. Shi, and Y. Zhang, “Secure multidimensional range queries in sensor

networks,” in Proc. ACM MobiHoc, 2009, pp.197–206.

[13] H. Hacigümüş, B. Iyer, C. Li, and S. Mehrotra, “Executing SQL over encrypted data in

the database-service-provider model,” in Proc. ACM SIGMOD, 2002, pp. 216–227.

[14] B. Hore, S. Mehrotra, and G. Tsudik, “A privacy-preserving index for range queries,” in

Proc. VLDB, 2004, pp. 720–731.

[15] R. Agrawal, J. Kiernan, R. Srikant, and Y. Xu, “Order preserving encryption for

numeric data,” in Proc. ACM SIGMOD, 2004, pp. 563–574.

[16] D. X. Song, D. Wagner, and A. Perrig, “Practical techniques for searches on encrypted

data,” in Proc. IEEE S&P, 2000, pp. 44–55.

[17] P. Golle, J. Staddon, and B. Waters, “Secure conjunctive keyword search over encrypted

data,” in Proc. ACNS, 2004, pp. 31–45.

[18] D. Boneh and B. Waters, “Conjunctive, subset, and range queries on encrypted data,” in

Proc. TCC, 2007, pp. 535–554.

[19] P. Devanbu, M. Gertz, C. Martel, and S. G. Stubblebine, “Authentic data publication

over the internet,” J. Comput. Security, vol. 11, no. 3, pp. 291–314, 2003.

[20] H. Pang and K.-L. Tan, “Authenticating query results in edge computing,” in Proc.

ICDE, 2004, p. 560.

SCETW BE IV Year II Sem IT-Dept

Page 50: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 50

POWER POINT SLIDES

SCETW BE IV Year II Sem IT-Dept

Page 51: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 51

SCETW BE IV Year II Sem IT-Dept

Page 52: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 52

SCETW BE IV Year II Sem IT-Dept

Page 53: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 53

SCETW BE IV Year II Sem IT-Dept

Page 54: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 54

SCETW BE IV Year II Sem IT-Dept

Page 55: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 55

SCETW BE IV Year II Sem IT-Dept

Page 56: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 56

SCETW BE IV Year II Sem IT-Dept

Page 57: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 57

SCETW BE IV Year II Sem IT-Dept

Page 58: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 58

SCETW BE IV Year II Sem IT-Dept

Page 59: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 59

SCETW BE IV Year II Sem IT-Dept

Page 60: Privacy and Integrity Presrving Range Queries in Sensor Networks documentation

B.C.Sangeetha Privacy and Integrity preserving Range queries in Sensor Networks 60

SCETW BE IV Year II Sem IT-Dept