modelling pairwise key predistribution in the presence of unreliable links

100
PRESENTED BY : GVS.SAIKIRAN(10401A0514) G.SAIKUMAR(10401A0515) D.VIVEK(10401A0509) R.BHEEMRAO(10401A0531 T.BALAKRISHNA(10401A0537)

Upload: saikiran-gvs

Post on 11-Jul-2015

800 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Modelling pairwise key predistribution in the presence of unreliable links

PRESENTED BY :

GVS.SAIKIRAN(10401A0514)

G.SAIKUMAR(10401A0515)

D.VIVEK(10401A0509)

R.BHEEMRAO(10401A0531

T.BALAKRISHNA(10401A0537)

Page 2: Modelling pairwise key predistribution in the presence of unreliable links

•Investigating the secure connectivity of wireless sensor networks under the random pairwise key predistribution scheme.• Here we assume a (simplified) communication model where unreliable wireless links are represented as independent on/off channels.•We present conditions on how to scale the model parameters so that the network 1) has no secure node that is isolated and2) is securely connected, both with high probability, when the

number of sensor nodes becomes large.

Page 3: Modelling pairwise key predistribution in the presence of unreliable links

WIRLESS SENSOR NETWORK:

•(WSN) consists of spatially distributed autonomous sensors to monitor physical or environmental conditions, such as temperature, sound, pressure, etc and to pass their data through the network to a main location.•The WSN is built of "nodes" – from a few to several hundreds or even thousands, where each node is connected to one (or sometimes several) sensors.•Each such sensor network node has typically several parts:1. a radio transceiver with an internal antenna or connection to an

external antenna.2. a microcontroller.3. an electronic circuit for interfacing with the sensors.4. an energy source, usually a battery.

Page 4: Modelling pairwise key predistribution in the presence of unreliable links

Traditional key exchange and distribution protocols are based ontrusting third parties, and this makes them inadequate for large-scaleWSNs whose topologies are unknown prior to deployment. Randomkey predistribution schemes were introduced to address some of thesedifficulties.

• Many security schemes developed for general network environments do not take into account the unique features of WSNs:• Public key cryptography is not feasible computationally because ofthe severe limitations imposed on the physical memory and powerconsumption of the individual sensors.

• Traditional key exchange and distribution protocols are based on trusting third parties, and this makes them inadequate for large-scale WSNs whose topologies are Unknown prior to deployment.•Random key predistribution schemes were introduced to address some

of these difficulties.

Page 5: Modelling pairwise key predistribution in the presence of unreliable links
Page 6: Modelling pairwise key predistribution in the presence of unreliable links

• Randomization in the key assignments alone affects the establishment of a secure network in the best of circumstances.•By disregarding the unreliability of the wireless links, the resulting dimensioning guidelines are likely to be too optimistic.•Nodes will have fewer neighbors since some of the communication links may be impaired.•As a result, the desired connectivity properties may not be achieved if dimensioning is done according to results derived under full visibility.•Hacking is done easily.

Page 7: Modelling pairwise key predistribution in the presence of unreliable links

In this paper, in an attempt to go beyond full visibility, we revisit thepairwise key predistribution scheme of Chan et al.

Under more realistic assumptions that account for the possibility thatcommunication links between nodes may not be available.

This could occur due to the presence of physical barriers betweennodes or because of harsh environmental conditions severely impairingtransmission.

Page 8: Modelling pairwise key predistribution in the presence of unreliable links
Page 9: Modelling pairwise key predistribution in the presence of unreliable links

•Even if some nodes are captured, the secrecy of the remaining nodes is perfectly preserved.•Unlike earlier schemes, this pairwise scheme enables both node-to-node authentication and quorum-based revocation.•Secure Key Generation•Channels are Mutually independent.•An overall system model is then constructed by intersecting the random graph model of the pairwise key distribution scheme (under full visibility).

Page 10: Modelling pairwise key predistribution in the presence of unreliable links

System : Pentium IV 2.4 GHz.Hard Disk : 20 GB.Monitor : 15 VGA Colour.Mouse : Logitech.Ram : 512 Mb.

Page 11: Modelling pairwise key predistribution in the presence of unreliable links

Operating system : Windows XP.Coding Language : JAVATechniques : RMI, SWING

Page 12: Modelling pairwise key predistribution in the presence of unreliable links

Network Deployment Module

Pair-wise Key Generation

Key Distribution

Key Authentication and Validation

Page 13: Modelling pairwise key predistribution in the presence of unreliable links

Our First module is Network Deployment Module, where the WirelessSensor Network (WSN) nodes are deployed. User can give the numberof required nodes. Based on it the Nodes are deployed. Each nodesdisplay with a Unique ID in it. The node also depicts their EnergyLevels.

Page 14: Modelling pairwise key predistribution in the presence of unreliable links

In this module, we implement a simple communication model wherechannels are mutually independent, and are either on or off. An overallsystem model is then constructed by intersecting the random graphmodel of the pairwise key distribution scheme. Pair Wise key isgenerated as such like between two nodes. For this new random graphstructure, we establish zero-one laws for two basic (and related) graphproperties, namely graph connectivity and the absence of isolatednodes, when the model parameters are scaled with the number ofusers.

Page 15: Modelling pairwise key predistribution in the presence of unreliable links

In this module, we implement an attempt to go beyond full visibility, we revisit the pair-wise key predistribution scheme. The key generated in the previous module, is distributed to the pair module.

Page 16: Modelling pairwise key predistribution in the presence of unreliable links

In this module, keys are validated and then the data is transferred. If the key is not received by the node, then the node cannot receive the data. Only the nodes which receive the key can validate and receive the data.

Page 17: Modelling pairwise key predistribution in the presence of unreliable links
Page 18: Modelling pairwise key predistribution in the presence of unreliable links

Key Distribution

Key Verification and Authentication

PairWise Key Generation

Wireless Sensor NetworkNode Deployment

Page 19: Modelling pairwise key predistribution in the presence of unreliable links

•Many security schemes developed for general network environments do not take into account the unique features of WSNs:• Public key cryptography is not feasible computationally because ofthe severe limitations imposed on the physical memory and powerconsumption of the individual sensors.• Traditional key exchange and distribution protocols are based on trusting third parties, and this makes them inadequate for large-scale WSNs whose topologies are Unknown prior to deployment.•Random key predistribution schemes were introduced to address some of these

difficulties.

Page 20: Modelling pairwise key predistribution in the presence of unreliable links

In this paper, in an attempt to go beyond full visibility, we revisit thepairwise key predistribution scheme of Chan et al.

Under more realistic assumptions that account for the possibility thatcommunication links between nodes may not be available.

This could occur due to the presence of physical barriers betweennodes or because of harsh environmental conditions severely impairingtransmission.

Page 21: Modelling pairwise key predistribution in the presence of unreliable links

•Software Requirements Specification plays an important role in creating quality software solutions. Specification is basically a representation process. Requirements are represented in a manner that ultimately leads to successful software implementation.•Requirements may be specified in a variety of ways. •However there are some guidelines worth following: -

1. Representation format and content should be relevant to the problemInformation contained within the specification should be nestedDiagrams and other notational forms should be restricted in number and consistent in use.

2. Representations should be revisable.

Page 22: Modelling pairwise key predistribution in the presence of unreliable links

The system after careful analysis has been identified to be presented with the

Requirement ID Specification

1 The system should provide a provision for user to start

RMI server.

2 The system should provide a provision for user to run

the server.

3 The system should provide a provision for user to create

6 WSN nodes to show three pairs.

4 The system should provide a provision for user to give

noode name and node size.

5 The system should provide a provision for user to

generate key for the respected nodes.

6 The system should provide a provision for user to

receive key for the respected nodes.

Page 23: Modelling pairwise key predistribution in the presence of unreliable links

7 The system should provide a provision for user to select

particular node to generate key one by one.

8 The system should provide a provision for user to select

particular node to receive key one by one.

9 The system should provide a provision for user to server to find

the optimized path to send the file.

10 The system should provide a provision for user to browse file in

the respected selective files.

11 The system should provide a provision for user to receive the

data of the uploaded file.

12 The system should provide a provision for user to give access if

other node tries to receive data it should not be able to receive.

13 The system should provide a provision for user to share key

error message.

Page 24: Modelling pairwise key predistribution in the presence of unreliable links

The DFD is also called as bubble chart. It is a simple graphical formalism that can be used to represent a system in terms of input data to the system, various processing carried out on this data, and the output data is generated by this system.The data flow diagram (DFD) is one of the most important modeling tools. It is used to model the system components. These components are the system process, the data used by the process, an external entity that interacts with the system and the information flows in the system.DFD shows how the information moves through the system and how it is modified by a series of transformations. It is a graphical technique that depicts information flow and the transformations that are applied as data moves from input to output.

Page 25: Modelling pairwise key predistribution in the presence of unreliable links

S T A RT

NO DE DEPLOYEM ENT

NO DES CREATIO N

KEY D ISTRIBUTION

KEY RECEIV ING

SECURE

DATA TRANSM ISS IO N

STO P

PAIRW ISE KEY GENERATION

Page 26: Modelling pairwise key predistribution in the presence of unreliable links

UML stands for Unified Modeling Language. UML is a standardized general-purpose modeling language in the field of object-oriented software engineering. The standard is managed, and was created by, the Object Management Group.The goal is for UML to become a common language for creating models of object oriented computer software. In its current form UML is comprised of two major components: a Meta-model and a notation. In the future, some form of method or process may also be added to; or associated with, UML.The Unified Modeling Language is a standard language for specifying, Visualization, Constructing and documenting the artifacts of software system, as well as for business modeling and other non-software systems.The UML represents a collection of best engineering practices that have proven successful in the modeling of large and complex systems.The UML is a very important part of developing objects oriented software and the software development process. The UML uses mostly graphical notations to express the design of software projects.

Page 27: Modelling pairwise key predistribution in the presence of unreliable links

The Primary goals in the design of the UML are as follows:

1.Provide users a ready-to-use, expressive visual modeling Languageso that they can develop and exchange meaningful models.

2.Provide extendibility and specialization mechanisms to extendthe core concepts.

3.Be independent of particular programming languages and development process.

4.Provide a formal basis for understanding the modeling language.5.Encourage the growth of OO tools market.6.Support higher level development concepts such as

collaborations, frameworks, patterns and components.7.Integrate best practices.

Page 28: Modelling pairwise key predistribution in the presence of unreliable links

A use case diagram in the 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 a use case diagram is to show what system functions are performed for which actor. Roles of the actors in the system can be depicted.

Page 29: Modelling pairwise key predistribution in the presence of unreliable links

N O D EN O DE

N ode D eploym ent

R M I connection

K EY

transferring

F ile to transfer w ith

key generated

Receive a F ile

Key Verification

Key D istribution

Pairw ise Key G eneration

Page 30: Modelling pairwise key predistribution in the presence of unreliable links

In software engineering, a class diagram in the Unified Modeling Language (UML) is a type of static structure diagram that describes the structure of a system by showing the system's classes, their attributes, operations (or methods), and the relationships among the classes. It explains which class contains information.

Page 31: Modelling pairwise key predistribution in the presence of unreliable links

RO U T ER

IPA D D R ES S

FIL E BY T E S

K EY

R O U T ER

A C K

R EC IE V E ()

SE N D ()

K EY V E R IF IC A TIO N ()

S EN D IN G N O D E

FIL E

K EY G EN E R A T IO N

IPA D D R ES S

FIL E BY T E S

PO RT N U M B E R

A C K

SO CK ET C O N ()

SE N D ()

K EY G EN E R A T IO N

R EC E IV IN G N O D E

FI LE

K E Y

R E CS T A T U S

FI LE B YT E S

A C K

S O C K ET C O N ()

R E CE IV E ()

K E Y V ER IF IC A T IO N ()

Page 32: Modelling pairwise key predistribution in the presence of unreliable links

A sequence diagram in 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. Sequence diagrams are sometimes called event diagrams, event scenarios, and timing diagrams.

Page 33: Modelling pairwise key predistribution in the presence of unreliable links
Page 34: Modelling pairwise key predistribution in the presence of unreliable links
Page 35: Modelling pairwise key predistribution in the presence of unreliable links

Activity diagrams are graphical representations of workflows of stepwise activities and actions with support for choice, iteration and concurrency. In the Unified Modeling Language, activity diagrams can be used to describe the business and operational step-by-step workflows of components in a system. An activity diagram shows the overall flow of control.

Page 36: Modelling pairwise key predistribution in the presence of unreliable links

SER VERC LIEN T

C onnecting..

F ILE REC EIVED

IP Address

File to Send

NO

Yes

C onnecting..

socket

connection

TRA N SA CTIO N

FA ILED

R OU TER

IP A ddress

checkNO

File N ot

Received

Sta rt Fi le

R ec eiving

Yes

Key Verification

Ye s

C onnecting ..

SEN D ING

File received

File Transfered

K ey Generation

IP Address

FILE Recieving

YES

C lient socket

connec tion

File sending Failed

K ey Verification

File R ecieving Error

N O

Page 37: Modelling pairwise key predistribution in the presence of unreliable links
Page 38: Modelling pairwise key predistribution in the presence of unreliable links
Page 39: Modelling pairwise key predistribution in the presence of unreliable links

import java.security.spec.KeySpec;

import javax.crypto.Cipher;import javax.crypto.SecretKey;import javax.crypto.SecretKeyFactory;import javax.crypto.spec.DESedeKeySpec;

import org.apache.commons.codec.binary.Base64;

public class KeyGenerarion {private static final String UNICODE_FORMAT = "UTF8";

public static final String DESEDE_ENCRYPTION_SCHEME = "DESede";

Page 40: Modelling pairwise key predistribution in the presence of unreliable links

private KeySpec ks;private SecretKeyFactory skf;private Cipher cipher;byte[] arrayBytes;private String myEncryptionKey;private String myEncryptionScheme;SecretKey key;

public KeyGenerarion() throws Exception {myEncryptionKey = "ThisIsSpartaThisIsSparta";myEncryptionScheme = DESEDE_ENCRYPTION_SCHEME;

arrayBytes = myEncryptionKey.getBytes(UNICODE_FORMAT);ks = new DESedeKeySpec(arrayBytes);skf = SecretKeyFactory.getInstance(myEncryptionScheme);cipher = Cipher.getInstance(myEncryptionScheme);key = skf.generateSecret(ks);

}

Page 41: Modelling pairwise key predistribution in the presence of unreliable links

public String encrypt(String unencryptedString) {String encryptedString = null;try {

cipher.init(Cipher.ENCRYPT_MODE, key);byte[] plainText =

unencryptedString.getBytes(UNICODE_FORMAT);byte[] encryptedText =

cipher.doFinal(plainText);encryptedString = new

String(Base64.encodeBase64(encryptedText));} catch (Exception e) {

e.printStackTrace();}return encryptedString;

}

public String decrypt(String encryptedString) {String decryptedText = null;

Page 42: Modelling pairwise key predistribution in the presence of unreliable links

try {cipher.init(Cipher.DECRYPT_MODE, key);byte[] encryptedText =

Base64.decodeBase64(encryptedString);byte[] plainText = cipher.doFinal(encryptedText);decryptedText = new String(plainText);

} catch (Exception e) {e.printStackTrace();

}return decryptedText;

}

}

Page 43: Modelling pairwise key predistribution in the presence of unreliable links

import java.awt.Color;import java.awt.FileDialog;import java.awt.event.ActionEvent;import java.awt.event.ActionListener;import java.awt.event.KeyEvent;import java.io.BufferedReader;import java.io.FileNotFoundException;import java.io.FileOutputStream;import java.io.FileReader;import java.io.IOException;import java.net.MalformedURLException;import java.rmi.Naming;import java.rmi.NotBoundException;import java.rmi.RemoteException;import java.util.Random;import java.util.logging.Level;import java.util.logging.Logger;

import javax.swing.JButton;import javax.swing.JFileChooser;

Page 44: Modelling pairwise key predistribution in the presence of unreliable links

import javax.swing.JLabel;import javax.swing.JOptionPane;import javax.swing.JScrollPane;import javax.swing.JTextArea;import javax.swing.JTextField;

//import Utils.KeyGenerarion;

public class Node extends javax.swing.JFrame {

static String NodeName;static String NodeN;static int noN;static String hp;

public Node() {initComponents();

this.getContentPane().setBackground(Color.PINK);this.setTitle("NODE:0");

Page 45: Modelling pairwise key predistribution in the presence of unreliable links

NodeNMN.setText("NODE:0");ndsz.setText(NodeNMN.getText());blsz.setText("2");recKey.setEnabled(false);ReceivedKey.setEnabled(false);

}public Node( String get, String a) {

initComponents();this.getContentPane().setBackground(Color.PINK);

//System.out.println("node name :"+NodeName);

NodeNMN.setText(get+a);ndsz.setText(NodeNMN.getText());blsz.setText("2");NodeN = get;noN = Integer.parseInt(a);hp = get+a;

Page 46: Modelling pairwise key predistribution in the presence of unreliable links

System.out.println("Node Current :"+hp);

this.setTitle(get+a);if(get.equals(null)||get.equals("")){

}else{Deploy.setEnabled(false);;//KeyGen.setEnabled(false);//KeyDs.setEnabled(false);//Browse.setEnabled(false);//Send.setEnabled(false);

}}private void initComponents() {

title = new javax.swing.JLabel();energy = new javax.swing.JLabel();nodeDeploy = new javax.swing.JLabel();nodeSize = new javax.swing.JLabel();

Page 47: Modelling pairwise key predistribution in the presence of unreliable links

blockSize = new javax.swing.JLabel();selectFile = new javax.swing.JLabel();ReceivedFile = new javax.swing.JLabel();

ReceivedKey = new javax.swing.JLabel();genratedKey = new javax.swing.JLabel();NodeNMN = new javax.swing.JLabel();

engy = new JTextField();nddeply = new JTextField();ndsz = new JTextField();blsz = new JTextField();resk = new JTextField();keyval = new JTextField();dirFile = new JTextField();

ndsz.setEditable(false);blsz.setEditable(false);

Page 48: Modelling pairwise key predistribution in the presence of unreliable links

genKey = new JTextField();recKey = new JTextField();

dirFile.setEditable(false);resk.setEditable(false);keyval.setEditable(false);

DataArea = new JTextArea();DataArea.setRows(10);DataArea.setColumns(25);

ReceiveArea = new JTextArea();ReceiveArea.setRows(10);ReceiveArea.setColumns(25);ReceiveArea.setEditable(false);

scrlpne = new JScrollPane();scrlpne.setViewportView(DataArea);

scrlpne1 = new JScrollPane();

Page 49: Modelling pairwise key predistribution in the presence of unreliable links

scrlpne1.setViewportView(ReceiveArea);

nddeply.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyTyped(KeyEvent e) {char c = e.getKeyChar();if (((c >= 0) && (c <= 9))

||Character.isDigit(e.getKeyChar())) {//if(nddeply.getText()>=)

}else{getToolkit().beep();

e.consume();}

}});

ndsz.addKeyListener(new java.awt.event.KeyAdapter() {public void keyTyped(KeyEvent e) {

Page 50: Modelling pairwise key predistribution in the presence of unreliable links

char c = e.getKeyChar();if (((c >= 0) && (c <=

9))||Character.isDigit(e.getKeyChar())) {

}else{getToolkit().beep();

e.consume();}

}});blsz.addKeyListener(new java.awt.event.KeyAdapter() {

public void keyTyped(KeyEvent e) {char c = e.getKeyChar();if (((c >= 0) && (c <=

9))||Character.isDigit(e.getKeyChar())) {}else{

getToolkit().beep();e.consume();

}}

});

Page 51: Modelling pairwise key predistribution in the presence of unreliable links

Deploy = new JButton("Deploy Nodes");ReceiveKey = new JButton("Receive Key");KeyGen = new JButton("Key Generate");KeyDs= new JButton("Key Destribute");Browse = new JButton("Browse");Send = new JButton("Send");Save = new JButton("Save");Receive = new JButton("Receive");GeneralKey= new JButton("General Key");

setMinimumSize(new java.awt.Dimension(900, 700));getContentPane().setLayout(null);

Page 52: Modelling pairwise key predistribution in the presence of unreliable links

title.setFont(new java.awt.Font("Agency FB", 0, 45)); // NOI18Ntitle.setText("Modeling the Pairwise Key

Predistribution Scheme ");getContentPane().add(title);

energy.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0, 25)); // NOI18N

energy.setText("Energy");getContentPane().add(energy);

nodeDeploy.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25));

nodeDeploy.setText("Node Deploy ");getContentPane().add(nodeDeploy);

nodeSize.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0, 25)); // NOI18N

nodeSize.setText("Node Name ");getContentPane().add(nodeSize);

Page 53: Modelling pairwise key predistribution in the presence of unreliable links

blockSize.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25)); // NOI18N

blockSize.setText("Node Size");getContentPane().add(blockSize);

selectFile.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25)); // NOI18N

selectFile.setText("select File");getContentPane().add(selectFile);

ReceivedFile.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25)); // NOI18N

ReceivedFile.setText("Received File");getContentPane().add(ReceivedFile);

genratedKey.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25)); // NOI18N

genratedKey.setText("Genrated Key");getContentPane().add(genratedKey);

Page 54: Modelling pairwise key predistribution in the presence of unreliable links

NodeNMN.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25)); // NOI18N

//NodeNMN.setText("fsd ");getContentPane().add(NodeNMN);

ReceivedKey.setFont(new java.awt.Font("Bodoni MT Poster Compressed", 0,25)); // NOI18N

ReceivedKey.setText("Received Key");getContentPane().add(ReceivedKey);

engy.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(engy);engy.setEditable(false);engy.setText("" + getEnergy());

nddeply.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(nddeply);

Page 55: Modelling pairwise key predistribution in the presence of unreliable links

ndsz.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18NgetContentPane().add(ndsz);

blsz.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(blsz);

resk.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(resk);

keyval.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(keyval);dirFile.setFont(new java.awt.Font("Agency FB", 0, 25)); //

NOI18NgetContentPane().add(dirFile);

genKey.setFont(new java.awt.Font("Agency FB", 0, 22)); // NOI18N

getContentPane().add(genKey);

Page 56: Modelling pairwise key predistribution in the presence of unreliable links

recKey.setFont(new java.awt.Font("Agency FB", 0, 22)); // NOI18NgetContentPane().add(recKey);

scrlpne.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(scrlpne);

scrlpne1.setFont(new java.awt.Font("Agency FB", 0, 25)); // NOI18N

getContentPane().add(scrlpne1);

Deploy.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

getContentPane().add(Deploy);

KeyGen.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

getContentPane().add(KeyGen);

Page 57: Modelling pairwise key predistribution in the presence of unreliable links

KeyDs.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18NgetContentPane().add(KeyDs);

ReceiveKey.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

getContentPane().add(ReceiveKey);

Browse.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

getContentPane().add(Browse);

Save.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

getContentPane().add(Save);

Send.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

getContentPane().add(Send);

Receive.setFont(new java.awt.Font("Agency FB", 0, 15)); // NOI18N

Page 58: Modelling pairwise key predistribution in the presence of unreliable links

getContentPane().add(Receive);

GeneralKey.setFont(new java.awt.Font("Tekton Pro Ext", 0, 15)); // NOI18N

getContentPane().add(GeneralKey);

title.setBounds(70, 40, 760, 60);energy.setBounds(750, 0, 60, 60);nodeDeploy.setBounds(70, 135, 160, 60);nodeSize.setBounds(70, 180, 160, 60);blockSize.setBounds(70, 225, 160, 60);keyval.setBounds(470, 218, 160, 30);selectFile.setBounds(30, 362, 160, 30);ReceivedFile.setBounds(635, 383, 230, 28);

genratedKey.setBounds(540, 105, 160, 60);ReceivedKey.setBounds(540, 135, 160, 60);genKey.setBounds(640, 125, 160, 25);recKey.setBounds(640, 155, 160, 25);

Page 59: Modelling pairwise key predistribution in the presence of unreliable links

NodeNMN.setBounds(5,5,100,20);

engy.setBounds(800, 15, 60, 30);nddeply.setBounds(170, 150, 160, 30);ndsz.setBounds(170, 195, 160, 30);blsz.setBounds(170, 240, 160, 30);resk.setBounds(150, 302, 160, 30);dirFile.setBounds(110, 362, 260, 30);

scrlpne.setBounds(90, 412, 380, 200);scrlpne1.setBounds(510, 412, 380, 200);

Deploy.setBounds(350, 152, 100, 25);KeyGen.setBounds(350, 220, 100, 25);KeyDs.setBounds(650, 220, 100, 25);ReceiveKey.setBounds(30, 302, 100, 28);Browse.setBounds(385, 363, 100, 28);Save.setBounds(650, 632, 80, 25);Send.setBounds(220, 632, 80, 25);Receive.setBounds(635, 323, 100, 25);

Page 60: Modelling pairwise key predistribution in the presence of unreliable links

GeneralKey.setBounds(420, 280, 150, 28);

Deploy.addActionListener(new ButtonAction());KeyGen.addActionListener(new ButtonAction());ReceiveKey.addActionListener(new ButtonAction());KeyDs.addActionListener(new ButtonAction());Browse.addActionListener(new ButtonAction());

Send.addActionListener(new ButtonAction());Save.addActionListener(new ButtonAction());Receive.addActionListener(new ButtonAction());GeneralKey.addActionListener(new ButtonAction());

pack();}public static void main(String args[]) {

java.awt.EventQueue.invokeLater(new Runnable()){

Page 61: Modelling pairwise key predistribution in the presence of unreliable links

public void run() {new Node().setVisible(true);try {

System.out.println("node name :"+NodeName);

srvimp rob = new srvimp();Naming.rebind("1099", rob);

} catch (RemoteException e) {// TODO Auto-generated

catch blocke.printStackTrace();

} catch (MalformedURLException e) {// TODO Auto-generated

catch blocke.printStackTrace();

}}

});}

Page 62: Modelling pairwise key predistribution in the presence of unreliable links

private JTextField keyval;private JTextField dirFile;

private JTextField genKey;private JTextField recKey;

private JTextArea DataArea;private JTextArea ReceiveArea;

private JScrollPane scrlpne;private JScrollPane scrlpne1;

private JButton Deploy;private JButton ReceiveKey;private JButton KeyGen;private JButton KeyDs;private JButton Browse;private JButton Send;private JButton Save;

Page 63: Modelling pairwise key predistribution in the presence of unreliable links

private JButton Receive;private JButton GeneralKey;

//Map map = new HashMap();

public int getEnergy() {int energy = 0;Random random = new Random();energy = random.nextInt((99 - 30) + 30);return energy;

}

public int getKey() {int energy = 0;Random random = new Random();energy = random.nextInt((99 - 30) + 30);return energy;

}

Page 64: Modelling pairwise key predistribution in the presence of unreliable links

public class ButtonAction implements ActionListener {public void actionPerformed(ActionEvent e) {

if (e.getSource() == Deploy) {int getNode = 0;

try{getNode = Integer.parseInt(nddeply.getText());for(int i = 1;i<=getNode;i++)

{NodeName = "NODE:"+i;new Node("NODE:",""+i).setVisible(true);}

ReceiveKey.setEnabled(false);

Deploy.setEnabled(false);

Save.setEnabled(false);

Receive.setEnabled(false);

Page 65: Modelling pairwise key predistribution in the presence of unreliable links

scrlpne1.setVisible(false);}

catch(NumberFormatException es){

JOptionPane.showMessageDialog(null, "Check Input");}}

if (e.getSource() == KeyGen) {

if(ndsz.getText().trim().equals(null)||(ndsz.getText().trim().equals(""))) {JOptionPane.showMessageDialog(null, "Check Input");

} else if (blsz.getText().trim().equals(null)|| (blsz.getText().trim().equals("")))

{JOptionPane.showMessageDialog(null, "Check Input");

}else{String genK = ndsz.getText() + blsz.getText();

Page 66: Modelling pairwise key predistribution in the presence of unreliable links

try {

keyval.setText(new KeyGenerarion().encrypt(genK));

//genKey.setText(new KeyGenerarion().encrypt(genK));

KeyGen.setEnabled(false);} catch (Exception e1) {

e1.printStackTrace();}

}

}if (e.getSource() == KeyDs) {

//String hh = JOptionPane.showInputDialog(null,"Enter Receiver Name");

// JOptionPane.showMessageDialog(null, "Data Sending");

Page 67: Modelling pairwise key predistribution in the presence of unreliable links

if(keyval.getText().equals(null)||(keyval.getText().equals(""))){

JOptionPane.showMessageDialog(null,"Input Key Error..");}else{

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

try {srvint in = (srvint)

Naming.lookup(url);System.out.println("set");

in.setData(keyval.getText());//(getFile);System.out.println("setting

name "+NodeNMN.getText());

in.setnodeName(NodeNMN.getText());KeyDs.setEnabled(false);

genKey.setText(keyval.getText());//in.setReceiver(hh);

//JOptionPane.showMessageDialog(null,"Data Sending Completed");

}

Page 68: Modelling pairwise key predistribution in the presence of unreliable links

catch (MalformedURLException e1) {// TODO Auto-generated

catch blocke1.printStackTrace();

} catch (RemoteException e1) {// TODO Auto-generated

catch blocke1.printStackTrace();

} catch (NotBoundException e1) {// TODO Auto-generated

catch blocke1.printStackTrace();

}

}}

if (e.getSource() == ReceiveKey) {String url = "rmi://127.0.0.1/1099";System.out.println("ok");System.out.println("getCurr Node

:"+NodeNMN.getText());

Page 69: Modelling pairwise key predistribution in the presence of unreliable links

String hh = NodeNMN.getText().substring(NodeNMN.getText().length() - 1);// get Last Char

System.out.println("hh "+hh);String str =

NodeNMN.getText().substring(0, NodeNMN.getText().length()-1);//remover Last Char

System.out.println("str "+str);

String newNodes = str+"1";

try {srvint in = (srvint)

Naming.lookup(url);System.out.println("receive");

System.out.println("new Ves"+in.getnodeName());

String hh1 = in.getnodeName().substring(in.getnodeName().length() - 1);// get Last Char

int u = Integer.parseInt(hh1);

Page 70: Modelling pairwise key predistribution in the presence of unreliable links

int newU = u+1;

String str1 = in.getnodeName().substring(0, in.getnodeName().length()-1);//remover Last Char

String setNodeInc = str1+newU;System.out.println("news is

"+setNodeInc);

if(in.getData().equals(null)|| in.getData().equals("")){

JOptionPane.showMessageDialog(null,"Key Error");}

else if(NodeNMN.getText().equals(setNodeInc)){

JOptionPane.showMessageDialog(null, "Key Access Success");resk.setText(in.getData());

Page 71: Modelling pairwise key predistribution in the presence of unreliable links

recKey.setText(in.getData());}

else{

JOptionPane.showMessageDialog(null, "Key Access Error");}

//JOptionPane.showMessageDialog(null,"Data Sending Completed");

} catch (MalformedURLException e1) {

JOptionPane.showMessageDialog(null,"Key Error");} catch (RemoteException e1) {

JOptionPane.showMessageDialog(null,"Key Error");} catch (NotBoundException e1) {

JOptionPane.showMessageDialog(null,"Key Error");

Page 72: Modelling pairwise key predistribution in the presence of unreliable links

}}if (e.getSource() == Browse) {

JFileChooser jfc = new JFileChooser();jfc.showOpenDialog(jfc);//getFile = jfc.getSelectedFile().toString();

dirFile.setText(jfc.getSelectedFile().toString());String data = null;

BufferedReader br = null;try {

br = new BufferedReader(new FileReader(jfc.getSelectedFile()));}

catch (FileNotFoundException e1){

// TODO Auto-generated catch blocke1.printStackTrace();

}

Page 73: Modelling pairwise key predistribution in the presence of unreliable links

try {while ((data = br.readLine()) != null)

{

DataArea.append(data+"\n");

//sb.append(data + "\n");}// n();// System.out.println(sb.toString());

}catch (IOException ex)

{Logger.getLogger(Node.class.getName()).log(Level.SEVERE,null, ex);

}}if (e.getSource() == Send) {

if(DataArea.getText().equals(null)||DataArea.getText().equals(""))

Page 74: Modelling pairwise key predistribution in the presence of unreliable links

{JOptionPane.showMessageDialog(null,"File Data Error .")

}else

{StringBuilder ddsb = new StringBuilder();

ddsb.append(DataArea.getText());String url = "rmi://127.0.0.1/1099";

try {srvint in = (srvint) Naming.lookup(url);System.out.println("set all Data");in.setFileData(ddsb);in.setKey(genKey.getText());

JOptionPane.showMessageDialog(null,"File Data Sending Completed .");

} catch (MalformedURLException e1) {// TODO Auto-generated catch

block

Page 75: Modelling pairwise key predistribution in the presence of unreliable links

e1.printStackTrace();} catch (RemoteException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();} catch (NotBoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();}

}}

if (e.getSource() == Save) {

if(ReceiveArea.getText().equals(null)||ReceiveArea.getText().equals("")){

JOptionPane.showMessageDialog(null,"Null Data Received .");

Page 76: Modelling pairwise key predistribution in the presence of unreliable links

}else{SaveActionPerformed();}

}if (e.getSource() == Receive) {

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

try {srvint in = (srvint)

Naming.lookup(url);System.out.println("get all Data");

if(recKey.getText().equals(in.getKey())){ReceiveArea.append(in.getFileData().toString());

}else{

Page 77: Modelling pairwise key predistribution in the presence of unreliable links

JOptionPane.showMessageDialog(null,"Share Key Error .");}

} catch (MalformedURLException e1) {// TODO Auto-generated

catch blocke1.printStackTrace();

} catch (RemoteException e1) {// TODO Auto-generated

catch blocke1.printStackTrace();

} catch (NotBoundException e1) {// TODO Auto-generated

catch blocke1.printStackTrace();

}

}

if(e.getSource()==GeneralKey){

Page 78: Modelling pairwise key predistribution in the presence of unreliable links

String hCode = NodeNMN.getText();JOptionPane.showMessageDialog(null,""+hCode);

}

}}private void SaveActionPerformed() {

// TODO add your handling code here:String file, dir, path;String val = ReceiveArea.getText();byte[] b1 = val.getBytes();FileDialog fd2 = new FileDialog(this, "SAVE", FileDialog.SAVE);fd2.setVisible(true);file = fd2.getFile();dir = fd2.getDirectory();path = dir + file;

Page 79: Modelling pairwise key predistribution in the presence of unreliable links

try {FileOutputStream fos = new

FileOutputStream(path);for (int k = 0; k <= b1.length; k++) {

fos.write(b1[k]);}JOptionPane.showMessageDialog(null, "File

saved....");} catch (Exception ee) {}

}

}

Page 80: Modelling pairwise key predistribution in the presence of unreliable links

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 theSoftware 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.

Page 81: Modelling pairwise key predistribution in the presence of unreliable links

Unit testing involves the design of test cases that validate that the internal program logic is functioning properly, and that program inputs produce valid outputs. All decision branches and internal code flow should be validated. It is the testing of individual software units of the application .it is done after the completion of an individual unit before integration. This is a structural testing, that relies on knowledge of its construction and is invasive. Unit tests perform basic tests at component level and test a specific business process, application, and/or system configuration. Unit tests ensure that each unique path of a business process performs accurately to the documented specifications and contains clearly defined inputs and expected results.

Page 82: Modelling pairwise key predistribution in the presence of unreliable links

Integration tests are designed to test integrated software components to determine if they actually run as one program. Testing is event driven and is more concerned with the basic outcome of screens or fields. Integration tests demonstrate that although the components were individually satisfaction, as shown by successfully unit testing, the combination of components is correct and consistent. Integration testing is specifically aimed at exposing the problems that arise from the combination of components.

Page 83: Modelling pairwise key predistribution in the presence of unreliable links

Functional tests provide systematic demonstrations that functions tested are available as specified by the business and technical requirements, system documentation, and user manuals.Functional testing is centered on the following items:Valid Input : identified classes of valid input must be accepted.Invalid Input : identified classes of invalid input must be rejected.Functions : identified functions must be exercised.Output : identified classes of application outputs must be exercised.Systems/Procedures: interfacing systems or procedures must be invoked.

Page 84: Modelling pairwise key predistribution in the presence of unreliable links

System testing ensures that the entire integrated software system meets requirements. It tests a configuration to ensure known and predictable results. An example of system testing is the configuration oriented system integration test. System testing is based on process descriptions and flows, emphasizing pre-driven process links and integration points.

Page 85: Modelling pairwise key predistribution in the presence of unreliable links

White Box Testing is a testing in which in which the software tester has knowledge of the inner workings, structure and language of the software, or at least its purpose. It is purpose. It is used to test areas that cannot be reached from a black box level.

Page 86: Modelling pairwise key predistribution in the presence of unreliable links

Black Box Testing is testing the software without any knowledge of the inner workings, structure or language of the module being tested. Black box tests, as most other kinds of tests, must be written from a definitive source document, such as specification or requirements document, such as specification or requirements document. It is a testing in which the software under test is treated, as a black box .you cannot “see” into it. The test provides inputs and responds to outputs without considering how the software works.

Page 87: Modelling pairwise key predistribution in the presence of unreliable links

Test CasesTest

Case

ID

Test Case Procedure Expecting behavior Exhibiting

behaviorResult

1

Deploy new

Nodes

We have to enter some number in the Node Deploy

text field and click deploy button as server do

internally

If the field is entered with a char or

special word a beep sound should be

given bye system

Nodes are

deployedPass

2 Generate Keys Node-0 should generate a key We have to click Key Generate button

with which a key is generated randomly

A key generated Pass

3 Key

distribution

We have to distribute the key to next Node We have to click the Key distribution

button which internally distributes the

key from current node to next Node

Key is

distributedPass

4 Receiving and Key should be received from parent node We have to click the Receive Key Button

in the next Node

Key received Pass

5 Browse the

Data and send

A data which should be moved to client is browsed

and send it

We have to browse the data with browse

button or we can write it in the provided

text area and click send button

Data sent

Pass

6 Authenticatin

g

Current node should check the next node

with the generated and distributed key

Key of child node is checked and

verified whether it is isolated node

or not

Node is

checked

Pass

7 Receive Next Node should receive the data In the next generated node with the

provided receive button next node

should receive data

Data received

Pass

Page 88: Modelling pairwise key predistribution in the presence of unreliable links
Page 89: Modelling pairwise key predistribution in the presence of unreliable links
Page 90: Modelling pairwise key predistribution in the presence of unreliable links
Page 91: Modelling pairwise key predistribution in the presence of unreliable links
Page 92: Modelling pairwise key predistribution in the presence of unreliable links
Page 93: Modelling pairwise key predistribution in the presence of unreliable links
Page 94: Modelling pairwise key predistribution in the presence of unreliable links
Page 95: Modelling pairwise key predistribution in the presence of unreliable links
Page 96: Modelling pairwise key predistribution in the presence of unreliable links
Page 97: Modelling pairwise key predistribution in the presence of unreliable links

[1] I. F. Akyildiz, Y. Sankarasubramaniam, W. Su, and E. Cayirci, “Wireless sensor networks: A survey,” Comput. Netw., vol. 38, pp. 393–422, 2002.

[2] N. P. Anthapadmanabhan and A. M. Makowski, “On the absence of isolated nodes in wireless ad-hoc networks with unreliable links—A curious gap,” in Proc. IEEE Infocom, San Diego, CA, Mar. 2010, pp. 1–9.

[3] S. R. Blackburn and S. Gerke, “Connectivity of the uniform random intersection graph,” Discr. Math., vol. 309, pp. 5130–5140, 2009.

[4] M. Bloznelis, J. Jaworski, and K. Rybarczyk, “Component evolution in a secure wireless sensor network,” Networks, vol. 53, pp. 19–26, 2009.

[5] B. Bollobás, Random Graphs, ser. Cambridge Studies in Advanced Mathematics, 2nd ed. Cambridge, U.K.: Cambridge Univ. Press, 2001.

Page 98: Modelling pairwise key predistribution in the presence of unreliable links

[6] S. A. Çamtepe and B. Yener, “Key distribution mechanisms for wireless sensor networks: A survey.” Dept. Comput. Sci., Rensselaer Polytechnic Inst., Troy, NY, 2005, Tech. Rep. TR-05-07.

[7] H. Chan, A. Perrig, and D. Song, “Random key predistribution schemes for sensor networks,” in Proc. IEEE Symp. Res. Security Privacy, Oakland, CA, May 2003, pp. 197–213.

[8] R. D. Pietro, L. V. Mancini, A. Mei, A. Panconesi, and J. Radhakrishnan, “Redoubtable sensor networks,” ACM Trans. Inf. Syst. Security, vol. TISSEC 11, pp. 1–22, 2008.

[9] W. Du, J. Deng, Y. S. Han, and P. K. Varshney, “A pairwise key pre-distribution scheme for wireless sensor networks,” in Proc. 10th ACM Conf. Comput. Commun. Security, Washington, DC, Oct. 2003, pp. 42–51.[10] D. Dubhashi and A. Panconesi, Concentration ofMeasure for the Analysis of Randomized Algorithms. New York: Cambridge Univ. Press, 2009.

[11] L. Eschenauer and V. D. Gligor, “A key-management scheme for distributed sensor networks,” in Proc. ACM Conf. Comput. Commun. Security (CSS 2002), Washington, DC, Nov. 2002, pp. 41–47.

Page 99: Modelling pairwise key predistribution in the presence of unreliable links

In this paper, we developed a general framework for pairwise key predistribution in sensor networks based on the basic polynomial-based key predistribution. This framework allows study of multiple instantiations of possible pairwise key establishment schemes. As two of the possible instantiations, we developed the key predistribution scheme based on random subset assignment, and the grid-based key predistribution scheme. Our analysis of these schemes demonstrated that both schemes are superior to the existing approaches. Several directions are worth pursuing in our future research. We would like to further investing ate properties of such extensions and compare them with the existing techniques. Second, we observe that sensor nodes have low mobility in many applications. Thus, it may be desirable to develop location based schemes so that the nodes that can directly establish a pairwise key are arranged to be close to each other

Page 100: Modelling pairwise key predistribution in the presence of unreliable links