secure final

60
CHAPTER 1 INTRODUCTION 1.1 OVERVIEW OF THE PROJECT The exponential growth in the development and acceptance of mobile communications in recent years is especially observed in the fields of wireless local area networks, mobile systems, and ubiquitous computing. This growth is mainly due to the mobility offered to users, providing access to information anywhere, user friendliness, and easy deployment. Configuration services in spontaneous networks depend significantly on network size, the nature of the participating nodes and running applications. Spontaneous networks imitate human relations while having adaptability to new conditions and fault tolerance (the failure of a device or service should not damage the functionality). Methods based on imitating the behavior of human relations facilitate secure integration of services in spontaneous networks. Furthermore, cooperation among the nodes and quality of service for all shared network services should be provided. Spontaneous ad hoc networks require well defined, efficient and user-friendly security mechanisms. Tasks to be performed include: user identification, their authorization, address assignment, name service, operation, 1

Upload: vinoth-barithi

Post on 19-Aug-2015

15 views

Category:

Engineering


1 download

TRANSCRIPT

Page 1: Secure final

CHAPTER 1

INTRODUCTION

1.1 OVERVIEW OF THE PROJECT

The exponential growth in the development and acceptance of mobile

communications in recent years is especially observed in the fields of wireless local area

networks, mobile systems, and ubiquitous computing. This growth is mainly due to the

mobility offered to users, providing access to information anywhere, user friendliness,

and easy deployment. Configuration services in spontaneous networks depend

significantly on network size, the nature of the participating nodes and running

applications. Spontaneous networks imitate human relations while having adaptability to

new conditions and fault tolerance (the failure of a device or service should not damage

the functionality). Methods based on imitating the behavior of human relations facilitate

secure integration of services in spontaneous networks. Furthermore, cooperation among

the nodes and quality of service for all shared network services should be provided.

Spontaneous ad hoc networks require well defined, efficient and user-friendly security

mechanisms. Tasks to be performed include: user identification, their authorization,

address assignment, name service, operation, and safety. Generally, wireless networks

with infrastructure use Certificate Authority (CA) servers to manage node authentication

and trust. Although these systems have been used in wireless ad hoc and sensor networks,

they are not practical because a CA node has to be online (or is an external node) all the

time. Moreover, CA node must have higher computing capacity. Security should be

based on the required confidentiality, node cooperation, anonymity, and privacy.

Exchanging photos between friends requires less security than exchanging

confidential documents between enterprise managers. Moreover, all nodes may not be

able to execute routing and/or security protocols. Energy constraints, node variability,

error rate, and bandwidth limitations mandate the design and use of adaptive routing and

security mechanisms, for any type of devices and scenarios. Dynamic networks with

1

Page 2: Secure final

flexible memberships, group signatures, and distributed signatures are difficult to

manage.

To achieve a reliable communication and node authorization in mobile ad hoc

networks, key exchange mechanisms for node authorization and user authentication are

needed. The related literature shows several security methods such as pre-distribution key

algorithms, symmetric and asymmetric algorithms, intermediate node-based methods,

and hybrid methods. But these methods are not enough for spontaneous networks because

they need an initial configuration (i.e., network configuration) or external authorities (for

example, central certification authorities).

2

Page 3: Secure final

CHAPTER 2

LITERATURE REVIEW

2.1 Spontaneous Networking: An Application-Oriented Approach to Ad-hoc

Networking

An ad hoc network must operate independent of a pre-established or centralized

network management infrastructure, while still providing administrative services needed

to support applications. Address allocation, name resolution, service location,

authentication, and access control policies represent just some of the functionality that

must be supported-without pre-configuration or centralized services. In order to solve

these problems, it is necessary to leverage some aspect of the environment in which the

network operates. We introduce the notion of a spontaneous network, created when a

group of people come together for some collaborative activity. In this case, we can use

the human interactions associated with the activity in order to establish a basic service

and security infrastructure. We structure our discussion around a practical real-world

scenario illustrating the use of such a network, identifying the key challenges involved

and some of the techniques that can be used to address them.

2.2 User-Oriented and Service-Oriented Spontaneous Ad Hoc and Sensor Wireless

Networks

User-Oriented and Service-Oriented Spontaneous Ad Hoc and Sensor Wireless

Networks Jaime lloret, Lei Shu, Raquel Lacuest, and Min Chen Recent advances in ad

hoc and sensor wireless networks have brought us new designs and deployment

orientations. Even more, when the ad hoc (or sensor) wireless network integrate users and

services. On one hand, the Quality of Service for each user must be guaranteed. On the

other hand, the user behavior and the services offered for the users could affect to the

network performance. A spontaneous ad hoc (or sensor) network enables a group of users

3

Page 4: Secure final

to communicate and work together collaboratively very close to each other, sharing

services, during a period of time. They seek to imitate human relationships in order to

work together in groups, running on an existing technology. Devices used for

spontaneous ad hoc (or sensor) wireless networks have limited resources, few computing

capacity and low energy consumption. User-oriented and service-oriented spontaneous ad

hoc and sensor wireless networks can be used to solve a problem, to carry out a specific

task, or just to share services and resources between users, with no dependence on a

central server. There is a wide range of environments in which these networks can be

applied. This special issue tries to collect the most recent research of these types of

networks.

2.3 A Spontaneous Ad-Hoc Network to Share WWW Access

There are many cases where a mobile ad-hoc network must be built for a limited

period of time. In these networks topics such as auto-configuration, security mechanisms

and optimal performance have to be also taken into account. In this paper, we propose a

secure spontaneous ad-hoc network, based on direct peer-to-peer interaction, to grant a

quick, easy and secure access to the users to surf the Web. The paper shows the

description of our proposal, the procedure of the nodes involved in the system, the

security algorithms implemented and the designed messages. We will show how it can be

done step by step along the different sections of the paper, and always taking into account

the security and its performance. Although, some people have defined and described the

main features of spontaneous ad-hoc networks, nobody has published any design and

simulation until today. Spontaneous networking will enable a more natural form of

wireless computing when people physically meet in the real world. We also validate the

success of our proposal through several simulations and comparisons with a regular

architecture, taking into account the optimization of the resources of the devices. Finally,

we compare our proposal with other caching techniques published in the related

literature. The proposal has been developed with the main objective of improving the

communication and integration between different study centers of low resource

4

Page 5: Secure final

communities. That is, it lets communicate spontaneous networks, working collaboratively

and which have been created on different physical places.

2.4 A Survey of Key Management Schemes in Wireless Sensor Networks

Wireless sensor networks have many applications, vary in size, and are deployed

in a wide variety of areas. They are often deployed in potentially adverse or even hostile

environment so that there are concerns on security issues in these networks. Sensor nodes

used to form these networks are resource-constrained, which make security applications a

challenging problem. Efficient key distribution and management mechanisms are needed

besides lightweight ciphers. Many key establishment techniques have been designed to

address the tradeoff between limited memory and security, but which scheme is the most

effective is still debatable. In this paper, we provide a survey of key management

schemes in wireless sensor networks. We notice that no key distribution technique is

ideal to all the scenarios where sensor networks are used; therefore the techniques

employed must depend upon the requirements of target applications and resources of

each individual sensor network.

2.5 Securing Wireless Sensor Networks with Public Key Techniques

Wireless sensor networks (WSNs) have attracted a lot of researchers due to their

usage in critical applications. WSN have limitations on computational capacity, battery

etc which provides scope for challenging problems. Applications of WSN are drastically

growing from indoor deployment to critical outdoor deployment. WSN are distributed

and deployed in an un attend environment, due to this WSN are vulnerable to numerous

security threats. The results are not completely trustable due to their deployment in

outside and uncontrolled environments. In this current paper, we fundamentally focused

on the security issue of WSNs and proposed a protocol based on public key cryptography

for external agent authentication and session key establishment. The proposed protocol is

efficient and secure in compared to other public key based protocols in WSNs.

5

Page 6: Secure final

CHAPTER 3

SYSTEM ANALYSIS

3.1 Existing System:

Security features like confidentiality, integrity and authentication plays a vital role

in any form of communication be it wired or wireless. Authentication becomes difficult

in a wireless network that doesn’t have a fixed infrastructure and where the nodes of the

network are mobile. Such types of wireless networks, where there is a lack of

infrastructure and the mobility of nodes is frequent are termed as Mobile Ad-hoc

Networks (MANETs). This makes authentication a great challenge as it is not supported

by any fixed infrastructure. The authentication takes place in authenticated server causes

server down.

3.1.1 Disadvantages:

Authentication takes place in authenticated server makes server down.

If the node relieves from the network, then the re authentication mechanism is

done to verify the node, Then the node have to prove their identity to its neighbor.

Not efficient in managing workloads decrease performance and causes server

traffic.

6

Page 7: Secure final

3.2 Proposed System:

In proposed system the authentication takes place to trust the node. If the node

release from the network and ready to rejoin to the network by using re authentication

mechanism. The re authentication mechanism is done to avoid the malicious nodes. The

workload mechanism is being used to allocate the tasks with minimum computational

power and server Utilization for better performance.

3.2.1 Advantages:

1. Reduces the dependences on the Central authority for re-authentication avoiding

the attacks that are possible during re-authentication

2. Increases the performance reduces server Utilization

3. Valuable information will never be revealed during the communication

4. The proposed system is resistant to identity theft as the node access is controlled

by NIZKP.

7

Page 8: Secure final

CHAPTER 4

SYSTEM CONFIGURATION

4.1 Hardware Configuration

Hard disk : 40 GB

RAM : 512mb

Processor : Pentium IV

Monitor : 17’’Color Monitor

4.2 Software Configuration

Front-End : VS 2008

Coding Language : C#.net

Operating System : Windows XP

Back End : SQLSERVER

8

Page 9: Secure final

CHAPTER 5

SYSTEM DESIGN

5.1 System Architecture

9

User

LoginNetwork

TGS generate by server

Service server

Ensure login credential

Login match user join N/W

User data move to server

TGS key given by the authenticate server

Receive key from user provide service

Verify TGS key on authenticate server

Page 10: Secure final

5.2 UML Diagrams:

5.2.1 Use Case Diagram:

Authentication

Re-authentication

Server

Server Controls

Client

Workload Efficiency

10

Page 11: Secure final

5.2.2 Class Diagram:

Authentication

usernamepassword

registration()

Re-authentication

usrnamepassword

login()

Server Controls

clientnode

Grant Service()

Workload Efficiency

jobsweights

performance()Allocation()

11

Page 12: Secure final

5.2.3 Sequence Diagram:

Authentication Re-Authentication

Server Controls Workload Efficiency

Regitration

Login

Chek The Node

Provide Srvices

Use zero knowledge protocol

Validate the performance

Assign tasks

12

Page 13: Secure final

5.2.4 Collaboration Diagram:

Authentication Re-Authentication

Server controls Workload efficiency

1: Registration

2: Login

3: Check the node

4: Provide services

5: Use zero knowledge

protocol

6: Validate the performance

7: Assign tasks

13

Page 14: Secure final

5.2.5 ER-Diagram

14

Page 15: Secure final

5.3 Data Flow Diagram

15

Authenticates user then the Authenticated

server provides TGS

Verify the User with the

encrypted data in Authenticated

Server

Check the node availability and node

reconnection for reauthentication

Identify the Client or node and authenticate

Use zero knowledge Protocol

Validate the TGS From Client and

service server

Workload Mechanism is

used for efficient Usage of server side .

Page 16: Secure final

CHAPTER 6

PROBLEM DESCRIPTION

6.1 Modules:

1. Authentication

2. Re-authentication

3. Server Controls

4. Workload Efficiency

Modules Description:

6.1.1 Authentication:

Authentication process is always occurred prior to mobility management process

included location registrations and service delivery, and it also ensures network

resources are accessed by authorized clients and prevents resources from any illegal

client or damage. Therefore, authentication is the first concern in Manet. Authentication

process is occurred periodically and frequently, when service access expires, when

temporary connection services interrupt, or as a result of handover, Entire authentication

procedure from the beginning to the end is called as authentication session.

16

Join to the node

Authenticate User

User

Page 17: Secure final

6.1.2 Re-authentication:

Re-authentication happens when an authenticated node wants to rejoin the network

after it has lost its connectivity due to mobility. This mechanism is used mainly to avoid

the malicious nodes to enter into the network.

17

Re-authenticate Node

To Rejoin Network

Relieve From Network

Authenticate Node

Page 18: Secure final

6.1.3 Server Controls:

The legitimate user first joined in the network by proving the identity to neighbour

node. Then the user sends his details and wait for the TGS (TICKET Granting Session

key).If the authenticated server has identify the legitimate user it gets all the client details

,and grants the TGS. Based on the TGS key the user request service to the Service server,

the service server gets all the User details and verified with the Authenticated server. If

the verification is done and the user is Authenticated the service server provide valuable

services to the trusted user.

18

Service Server Provides Service by authenticating Authenticated service

Rejoin Node by Re-Authenticate Mechanism

Relieve From Network

Authenticate by Authenticated server

User

Page 19: Secure final

6.1.4 Workload Efficiency:

The system, the workload is done by identifying the weight of each job, The

weight of the job can be identified by the number of dependents to complete that job. If

the number of dependent job is high then this job is executed later in order based on the

weight. The jobs that are independent are executed first. This workload efficiency helps

to allocate the tasks with minimum computational power and server Utilization for better

performance.

19

Workload Efficiency

Zero Knowledge Protocol

Service Server

Authenticated server

Re Authenticate to rejoin

Authenticate to join

User

Page 20: Secure final

CHAPTER 7

RESULTS AND DISCUSSION

Login:

Register:

20

Page 21: Secure final

User Sign In:

Authentication Server:

21

Page 22: Secure final

Generate AST (Authenticated Server Token) and Sent to Client:

22

Page 23: Secure final

Sent Service Request to Authentication Server:

23

Page 24: Secure final

Generate CDK and Sent to Client:

24

Page 25: Secure final

Send CDK to Service Server:

25

Page 26: Secure final

Sent CDK to Service Server:

26

Page 27: Secure final

Verification in Authenticated Server:

27

Page 28: Secure final

Verification in Service Server:

28

Page 29: Secure final

CHAPTER 9

CONCLUSION AND FUTURE WORK

Conclusion

We have provided some procedures for self-configuration: a unique IP address is

assigned to each device, the DNS can be managed efficiently and the services can be

discovered automatically. We have also created a user-friendly application that has

minimal interaction with the user. A user without advanced technical knowledge can set

up and participate in a spontaneous network. The security schemes included in the

protocol allow secure communication between end users (bearing in mind the resource,

processing, and energy limitations of ad hoc devices).

Future Work:

A user without advanced technical knowledge can set up and participate in a

spontaneous network. The security schemes included in the protocol allow secure

communication between end users. In this the time Efficiency Re-authentication

mechanism is needed to improve security and prevent attackers.

29

Page 30: Secure final

APPENDIX

CODINGS

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Data.SqlClient;

using System.Security.Cryptography;

using System.IO;

using System.Management;

using System.Net;

using System.Threading;

namespace Client

{

public partial class ClientForm : Form

{

public ClientForm()

{

InitializeComponent();

}

SqlConnection con,cn;

SqlCommand cmd;

string s;

30

Page 31: Secure final

public enum enEnCryptDecrypt

{

DECRYPT, ENCRYPT

};

public void connection()

{

con = new SqlConnection("server=.\\sqlexpress;initial catalog=ZKP; Integrated Security

=true");

con.Open();

}

public static string enCode(String Message, String Key, enEnCryptDecrypt EnC)

{

int messageCount, keyCount, value = 0;

StringBuilder strRetVal = new StringBuilder();

if (Message.Length > 0 && Key.Length > 0)

{

try

{

for (messageCount = 0, keyCount = 0; messageCount < Message.Length;

messageCount++, keyCount++)

{

if (keyCount >= Key.Length) keyCount = 0; // Rotates the Key string counter to Zero

when character value is traversed till end

if (EnC == enEnCryptDecrypt.ENCRYPT)

value = (Message[messageCount]) + (Key[keyCount]); //When Encryption is required we

add ascii value of key with Message

else

value = (Message[messageCount]) - (Key[keyCount]); // When Decryption is required we

subtract ascii value of key with Message

31

Page 32: Secure final

strRetVal.Append(value); // Here we convert the ascii value to character and Append that

to Stringbuilder

}

}

catch (Exception ex)

{

// Clears the StringBuilder and Append Error Message in it.

strRetVal.Remove(0, strRetVal.Length);

strRetVal.Append("Error in Ecrypting:-" + ex.Message);

}

}

else

{

// Append Return message with proper valid string required.

strRetVal.Append("Enter valid Message and Key");

}

return strRetVal.ToString(); //Returns the Processed String.

}

private void ClientForm_Load(object sender, EventArgs e)

{

timer1.Start();

timer2.Start();

}

private void timer1_Tick(object sender, EventArgs e)

{

connection();

SqlDataReader dr;

string squery;

32

Page 33: Secure final

string starttime = DateTime.Now.TimeOfDay.ToString();

squery = "SELECT * from TblAuthenticate where PK=1 and status='1'";

cmd = new SqlCommand(squery, con);

dr = cmd.ExecuteReader();

if (dr.HasRows)

{

dr.Read();

textBox2.Text = dr["encryptedTicket"].ToString();

textBox3.Text = dr["Ticket"].ToString();

textBox4.Text = dr["ClientID"].ToString();

textBox5.Text = dr["MAC"].ToString();

}

con.Close();

connection();

squery = "SELECT * from TblAuthenticate where PK=1 and status2='1'";

cmd = new SqlCommand(squery, con);

dr = cmd.ExecuteReader();

if (dr.HasRows)

{

dr.Read();

textBox6.Text = dr["ServerSessionKey"].ToString();

}

con.Close();

con.Close();

connection();

squery = "SELECT * from TblAuthenticate where PK=1 and status6='1'";

cmd = new SqlCommand(squery, con);

dr = cmd.ExecuteReader();

if (dr.HasRows)

33

Page 34: Secure final

{

label8.Visible = true;

label8.Text = "Service Granted";

}

con.Close();

}

private void button1_Click(object sender, EventArgs e)

{

string squery;

connection();

squery = "update TblAuthenticate set Status1='1' where pk=1";

cmd = new SqlCommand(squery, con);

cmd.ExecuteNonQuery();

con.Close();

label8.Text = "Service Status Pending";

MessageBox.Show("Message C Sent To Authentication Server");

}

private void button2_Click(object sender, EventArgs e)

{

string squery;

connection();

textBox7.Text = enCode(textBox6.Text, "12345", enEnCryptDecrypt.ENCRYPT);

squery = "update TblAuthenticate set EncryptedServerSessionKey='" + textBox7.Text +

"', Status3='1' where pk=1";

cmd = new SqlCommand(squery, con);

cmd.ExecuteNonQuery();

con.Close();

MessageBox.Show("Message E Sent To Service Server");

}

34

Page 35: Secure final

private string RandomString(int size)

{

StringBuilder builder = new StringBuilder();

Random random = new Random();

char ch;

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

{

ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));

builder.Append(ch);

}

return builder.ToString();

}

private void timer2_Tick(object sender, EventArgs e)

{

listBox1.Items.Clear();

while (listBox1.Items.Count < 20)

{

Thread.Sleep(100);

string phase1 = RandomString(6);

string phase2 = RandomString(3);

string res = phase1 + phase2;

int flag = 0;

int i = 0;

for (i = 0; i < listBox1.Items.Count; i++)

{

listBox1.SelectedIndex = i;

if (listBox1.SelectedItem.ToString() == s)

{

flag = 1;

35

Page 36: Secure final

}

}

if (flag == 0)

{

listBox1.Items.Add(res);

}

}

timer2.Stop();

label8.Visible = false;

}

private void button3_Click(object sender, EventArgs e)

{

SqlCommand cmd;

string s;

SqlDataReader dr1;

connection();

s = "SELECT * from login";

cmd = new SqlCommand(s, con);

dr1 = cmd.ExecuteReader();

if (dr1.HasRows)

{

while (dr1.Read())

{

listBox2.Items.Add(dr1["username"]);

}

}

timer2.Start();

}

public static Int64 GenerateRandomNumber()

36

Page 37: Secure final

{

Random random = new Random((int)DateTime.Now.Ticks);

StringBuilder builder = new StringBuilder();

string s;

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

{

s = Convert.ToString(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));

builder.Append(s);

}

return Convert.ToInt64((builder.ToString()));

}

private void button4_Click(object sender, EventArgs e)

{

label9.Visible = true;

string s = Convert.ToString(GenerateRandomNumber());

label9.Text = s.ToString();

}

private void button5_Click(object sender, EventArgs e)

{

if (label9.Text == textBox8.Text)

{

MessageBox.Show("Paired SuccessFully to the User " +listBox2.Text);

}

else

{

MessageBox.Show("Pairing Failed");

}

}

private void button6_Click(object sender, EventArgs e)

37

Page 38: Secure final

{

string s1;

cn = new SqlConnection("server=.\\sqlexpress;initial catalog=ZKP; Integrated Security

=true");

cn.Open();

s1 = "insert into chat values('" + listBox2.Text + "','')";

cmd = new SqlCommand(s1, cn);

cmd.ExecuteNonQuery();

cn.Close();

string s2;

cn = new SqlConnection("server=.\\sqlexpress;initial catalog=ZKP; Integrated Security

=true");

cn.Open();

s2 = "update chat set sent='" + textBox9.Text + "' where username= '" + listBox2.Text +

"'";

cmd = new SqlCommand(s2, cn);

cmd.ExecuteNonQuery();

cn.Close();

MessageBox.Show("Message Sent to User " +listBox2.Text);

textBox9.Text = "";

}

private void button7_Click(object sender, EventArgs e)

{

MessageBox.Show("User " + textBox1.Text + " is Logging out");

listBox1.SelectedIndex = listBox1.Items.Count - 1;

MessageBox.Show(listBox1.Text);

connection();

string squery;

squery = "update tb set keyy='"+listBox1.Text+"' where pk=1";

38

Page 39: Secure final

cmd = new SqlCommand(squery, con);

cmd.ExecuteNonQuery();

con.Close();

}

private void button8_Click(object sender, EventArgs e)

{

SqlCommand cmd1;

string s;

SqlDataReader dr1;

connection();

s = "SELECT * from chat where username='"+listBox2.Text+"'";

cmd1 = new SqlCommand(s, con);

dr1 = cmd1.ExecuteReader();

if (dr1.HasRows)

{

while (dr1.Read())

{

textBox9.Text = (dr1["sent"]).ToString();

}

}

}

}

}

Authentication Server

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

39

Page 40: Secure final

using System.Linq;

using System.Text;

using System.Windows.Forms;

using System.Data.SqlClient;

using System.Security.Cryptography;

using System.IO;

using System.Management;

using System.Net;

namespace AuthenticatedServer

{

public partial class Form1 : Form

{

public Form1()

{

InitializeComponent();

}

SqlConnection con;

SqlCommand cmd;

public enum enEnCryptDecrypt

{

DECRYPT, ENCRYPT

};

private void button1_Click(object sender, EventArgs e)

{

string phase1=RandomString(8);

string phase2=RandomString(3);

textBox3.Text = phase1 + phase2;

textBox4.Text = enCode(textBox3.Text, textBox2.Text, enEnCryptDecrypt.ENCRYPT);

}

40

Page 41: Secure final

private string RandomString(int size)

{

StringBuilder builder = new StringBuilder();

Random random = new Random();

char ch;

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

{

ch = Convert.ToChar(Convert.ToInt32(Math.Floor(26 * random.NextDouble() + 65)));

builder.Append(ch);

}

return builder.ToString();

}

public void connection()

{

con = new SqlConnection("server=.\\sqlexpress;initial catalog=ZKP; Integrated Security

=true");

con.Open();

}

public static string enCode(String Message, String Key, enEnCryptDecrypt EnC)

{

int messageCount, keyCount, value = 0;

StringBuilder strRetVal = new StringBuilder();

if (Message.Length > 0 && Key.Length > 0)

{

try

{

for (messageCount = 0, keyCount = 0; messageCount < Message.Length;

messageCount++, keyCount++)

{

41

Page 42: Secure final

if (keyCount >= Key.Length) keyCount = 0;

if (EnC == enEnCryptDecrypt.ENCRYPT)

value = (Message[messageCount]) + (Key[keyCount]);

else

value = (Message[messageCount]) - (Key[keyCount]);

strRetVal.Append(value);

}

}

catch (Exception ex)

{

strRetVal.Remove(0, strRetVal.Length);

strRetVal.Append("Error in Ecrypting:-" + ex.Message);

}

}

else

{

strRetVal.Append("Enter valid Message and Key");

}

return strRetVal.ToString();

}

private void Form1_Load(object sender, EventArgs e)

{

timer1.Start();

}

private void button2_Click(object sender, EventArgs e)

{

string squery;

connection();

42

Page 43: Secure final

squery = "update TblAuthenticate set ticket='" + textBox3.Text + "',encryptedTicket='" +

textBox4.Text + "',Status='1' where pk=1";

cmd = new SqlCommand(squery, con);

cmd.ExecuteNonQuery();

con.Close();

MessageBox.Show("Message A & B Sent To Client");

}

private void timer1_Tick(object sender, EventArgs e)

{

connection();

SqlDataReader dr;

string squery;

string starttime = DateTime.Now.TimeOfDay.ToString();

squery = "SELECT * from TblAuthenticate where PK=1";

cmd = new SqlCommand(squery, con);

dr = cmd.ExecuteReader();

if (dr.HasRows)

{

dr.Read();

textBox1.Text = dr["UserName"].ToString();

textBox2.Text = dr["EncryptedPassword"].ToString();

}

con.Close();

connection();

squery = "SELECT * from TblAuthenticate where PK=1 and status1='1'";

cmd = new SqlCommand(squery, con);

dr = cmd.ExecuteReader();

if (dr.HasRows)

{

43

Page 44: Secure final

dr.Read();

textBox6.Text = dr["ClientID"].ToString();

textBox7.Text = dr["Ticket"].ToString();

}

con.Close();

connection();

squery = "SELECT * from TblAuthenticate where PK=1 and status4='1'";

cmd = new SqlCommand(squery, con);

dr = cmd.ExecuteReader();

if (dr.HasRows)

{

dr.Read();

textBox10.Text = dr["ServerSessionKey"].ToString();

textBox8.Text = dr["ClientID"].ToString();

}

con.Close();

}

private void button4_Click(object sender, EventArgs e)

{

string phase1 = RandomString(6);

string phase2 = RandomString(3);

textBox5.Text = phase1 + phase2;

}

private void button3_Click(object sender, EventArgs e)

{

string squery;

connection();

squery = "update TblAuthenticate set ServerSessionKey='" + textBox5.Text +

"',Status2='1' where pk=1";

44

Page 45: Secure final

cmd = new SqlCommand(squery, con);

cmd.ExecuteNonQuery();

con.Close();

MessageBox.Show("Message D Sent To Client");

}

private void button5_Click(object sender, EventArgs e)

{

string squery;

connection();

squery = "update TblAuthenticate set Status5='1' where pk=1";

cmd = new SqlCommand(squery, con);

cmd.ExecuteNonQuery();

con.Close();

MessageBox.Show("Verification Sent To Service Server");

}

}

}

45

Page 46: Secure final

References:

1. L.M. Feeney, B. Ahlgren, and A. Westerlund, “Spontaneous Networking: An

Application-Oriented Approach to Ad-hoc Networking,”

2. J. Lloret, L. Shu, R. Lacuesta, and M. Chen, “User-Oriented and Service-Oriented

Spontaneous Ad Hoc and Sensor Wireless Networks,”

3. S. Preuß and C.H. Cap, “Overview of Spontaneous Networking - Evolving

Concepts and Technologies,” Rostocker Informatik- Berichte,.

4. R. Lacuesta, J. Lloret, M. Garcia, and L. Pen˜ alver, “A Spontaneous Ad-Hoc

Network to Share WWW Access,”

5. Y. Xiao, V.K. Rayi, B. Sun, X. Du, F. Hu, and M. Galloway, “A Survey of Key

Management Schemes in Wireless Sensor Networks,”

6. J. Ba¨ckstro¨m and S. Nadjm-Tehrani, “Design of a Contact Service in a Jini-

Based Spontaneous Network,” Proc. Int’l Conf. and Exhibits on the Convergence

of IT and Comm., Aug. 2001.

7. V. Untz, M. Heusse, F. Rousseau, and A. Duda, “Lilith: an Interconnection

Architecture Based on Label Switching for Spontaneous Edge Networks,” Proc.

First Ann. Int’l Conf. Mobile and Ubiquitous Systems: Networking and Services

(Mobiquitous ’04), Aug. 2004.

8. L.M. Feeney, B. Ahlgren, A. Westerlund, and A. Dunkels, “Spontnet: Experiences

in Configuring and Securing Small Ad Hoc Networks,” Proc. Fifth Int’l Workshop

Network Appliances, Oct. 2002.

9. M. Danzeisen, T. Braun, S. Winiker, D. Rodellar, “Implementation of a Cellular

Framework for Spontaneous Network Establishment,” Proc. IEEE Wireless

Comm. and Networking Conf. (WCNC ’05), Mar. 2005.

10. J. Rekimoto, “SyncTap: Synchronous User Operation for Spontaneous Network

Connection,” Personal and Ubiquitous Computing, vol. 8, no. 2, pp. 126-134, May

2004.

46

Page 47: Secure final

11. C. Cornelius, A. Kapadia, D. Kotz, D. Peebles, M. Shin, and N. Triandopoulos,

“Anonysense: Privacy-Aware People-Centric Sensing,” Proc. Sixth Int’l Conf.

Mobile Systems, Applications, and Services (MobiSys ’08), pp. 17-20, June 2008.

12. R. Lacuesta, J. Lloret, M. Garcia, and L. Pen˜ alver, “Two Secure and Energy-

Saving Spontaneous Ad-Hoc Protocol for Wireless Mesh Client Networks,” J.

Network and Computer Applications, vol. 34, no. 2, pp. 492-505, Mar. 2011.

13. J. Sun, C. Zhang, Y. Zhang, and Y. (Michael) Fang, “An Identity- Based Security

System for User Privacy in Vehicular Ad Hoc Networks,” IEEE Trans. Parallel

and Distributed Systems, vol. 21, no. 9, pp. 1227-1239, Sept. 2010.

47