You are on page 1of 98

Secured Data Transmission in Mobile Ad-hoc Network

A PROJECT REPORT

Submitted by

SIVANAND.M
SENTHIL MANOHAR.S
SANKAR RAMAN.P

in partial fulfillment for the award of degree

of

BACHELOR OF ENGINEERING

in

COMPUTER SCIENCE AND ENGINEERING

NATIONAL ENGINEERING COLLEGE,KOVILPATTI



ANNA UNIVERSITY: CHENNAI 600 025

MAY 2005

1
ANNA UNIVERSITY : CHENNAI 600 025

BONAFIDE CERTIFICATE

Certified that this project report “JAVA PRODUCTIVITTY AIDS” is the


bonafide work of xxx and xxxx who carried out the project work under my
supervision

SIGNATURE SIGNATURE

xxxx xxx
HEAD OF THE DEPARTMENT SUPERVISOR

2
Lecturer

Index

Sl.No Particular Page No

3
INTRODUCTION

4
An ad-hoc mobile network is a collection of mobile nodes that are
dynamically and arbitrarily located in such a manner that the interconnections between
nodes are capable of changing on a continual basis. The primary goal of such an ad-hoc
network routing protocol is correct and efficient route establishment between a pair of
nodes so that messages may be delivered in a timely manner. LAR is an on-demand
protocol who is based on the DSR(Dynamic Source Routing). The Location Aided
Routing protocol uses location information to reduce routing overhead of the ad-hoc
network! Normally the LAR protocol uses the GPS(Global Positioning System) to get
these location information’s. With the availability of GPS, the mobile hosts knows there
physical location.

Ad hoc networks are a new wireless networking paradigm for mobile hosts.
Unlike traditional mobile wireless networks, ad hoc networks do not rely on any fixed
infrastructure. Instead, hosts rely on each other to keep the network connected. The
military tactical and other security-sensitive operations are still the main applications of
ad hoc networks, although there is a trend to adopt ad hoc networks for commercial uses
due to their unique properties. One main challenge in design of these networks is their
vulnerability to security attacks. In this paper, we study the threats an ad hoc network
faces and the security goals to be achieved. We identify the new challenges and
opportunities posed by this new networking environment and explore new approaches to
secure its communication. In particular, we take advantage of the inherent redundancy in
ad hoc networks — multiple routes between nodes — to defend routing against denial of
service attacks. We also use replication and new cryptographic schemes, such as
threshold cryptography, to build a highly secure and highly available key management
service, which forms the core of our security framework.

5
Ad hoc networks are a new paradigm of wireless communication for mobile hosts (which
we call nodes). In an ad hoc network, there is no fixed infrastructure such as base stations
or mobile switching centers. Mobile nodes that are within each other’s radio range
communicate directly via wireless links, while those that are far apart rely on other nodes
to relay messages as routers. Node mobility in an ad hoc network causes frequent
changes of the network topology. Figure 1 shows such an example: initially, nodes A and
D have a direct link between them. When D moves out of A’s radio range, the link is
broken. However, the network is still connected, because A can reach D through C, E,
and F. Military tactical operations are still the main application of ad hoc networks today.
For example, military units (e.g., soldiers, tanks, or planes), equipped with wireless
communication devices, could form an ad hoc network when they roam in a battlefield.
Ad hoc networks can also be used for emergency, law enforcement, and rescue missions.
Since an ad hoc network can be deployed rapidly with relatively low cost, it becomes an
attractive option for commercial uses such as sensor networks or virtual classrooms.

6
7
SYSTEM ANALYSIS

IDENTIFICATION OF NEEDS

EXISTING SYSTEM

Infra-structured Networks

The first one is to introduce a third fixed party (a base station) that will hand over
the offered traffic from a station to another, as illustrated in Figure 1. The same entity
will regulate the attribution of radio resources, for instance. When a node S wishes to
communicate to a node D, the former notifies the base station, which eventually
establishes a communication with the destination node. At this point, the communicating
nodes do not need to know of a route for one to each other. All that matters is that both
nodes source and destination are within the transmission range of the base station. If one
of them fails to fulfill this condition, the communication will abort.

S D
BASE STATION
E (OUT OF RANGE)

Infra structured Network

8
Here the base station’s range is illustrated by the oval. The two nodes S and D
which want to communicate are in the range of the base station. S send the message to the
base station which in turn forwards it to destination node D. Thus communication is
carried out with help of a base station. All messages have to pass through the base station.
Node E is out of the range of the base station this prevents it from communicating to
other nodes in the network. When node E wants to communicate to any node in the
network it has to contact the base station. Since it is out of range communication is not
possible.

What happens if the base station is unavailable? Or what happens if we are in a situation
where such an infrastructure does not exist at the first place?
The answer is that we simply do not communicate! This is where the second approach is
useful. JNote however that this form of centralized administration is very popular among
wide cellular networks such as GSM etc.

PROPOSED SYSTEM

Infra-structure-less Networks (Ad Hoc)

The second approach, called the Ad-Hoc, does not rely on any stationary infra
structure. The concept behind these infra-structureless networks is the collaboration
between its participating members, i.e, instead of making data transit through a fixed base
station, nodes consequentially forward data packets from one to another until a
destination node is finally reached. Typically, a packet may travel through a number of
network points before arriving at its destination.

9
Ad-hoc networking introduces a completely new flavor of network formation. The term
Ad-Hoc means, in this instance, a type instantaneous network connecting various mobile
devices without the intervention of fixed infrastructure. The routers and hosts are free to
move randomly and organize themselves in an arbitrary fashion, thus the network
topology changes rapidly and unpredictably. Absence of a supporting structure in mobile
ad-hoc networks, to a certain extent, invalidates almost all of the existing techniques
developed for routine network controls in the existing wireless networks.

A MANET consists of mobile platforms (e.g., a router with multiple hosts and wireless
communications devices)--herein simply referred to as "nodes"--which are free to move
about arbitrarily. The nodes may be located in or on airplanes, ships, trucks, cars, perhaps
even on people or very small devices, and there may be multiple hosts per router. A
MANET is an autonomous system of mobile nodes. The system may operate in isolation,
or may have gateways to and interface with a fixed network.

10
Infra-structure less Network

Here the node S wants to communicate to node D. The oval indicates the communication
range of the node. The communication range of S does not exceed to include D. In this
case routing is necessary, node E is in the range of S which has D in its range. So S in
order to communicate to D, first sends the message to E which inturn forwards it to D.
Thus the node E acts as a router and a node.

Thus in this way the Ad Hoc network co-operates to forward packets for each other to
communicate without the help of a base station. But there are several issues like selfish
nodes, malicious behavior, routing challenges, security etc.

11
STRUCTURE OF THE MANET

MANET nodes are equipped with wireless transmitters and receivers using
antennas which may be omnidirectional (broadcast), highly directional (point-to-point),
possibly steerable, or some combination thereof. At a given point in time, depending on
the nodes' positions and their transmitter and receiver coverage patterns, transmission
power levels and co-channel interference levels, a wireless connectivity in the form of a
random, multi hop graph or "Ad Hoc" network exists between the nodes. This ad hoc
topology may change with time as the nodes move or adjust their transmission and
reception parameters.

Network Structure

Antenna Node S

Message

Node D
Antenna

The communication is through the antennas attached. The radio range of the node is the
range of communication. Messages are transmitted through the antennas and are received
by antennas.

12
CHARACTERISTICS OF MANET

MANETs have several salient characteristics:

Dynamic topologies: Nodes are free to move arbitrarily. Thus, the network topology--
which is typically multihop--may change randomly and rapidly at unpredictable times,
and may consist of both bidirectional and unidirectional links.

Bandwidth-constrained, variable capacity links: Wireless links will continue to have


significantly lower capacity than their hardwired counterparts. In addition, the realized
throughput of wireless communications--after accounting for the effects of multiple
access, fading, noise, and interference conditions, etc.--is often much less than a radio's
maximum transmission rate.

One effect of the relatively low to moderate link capacities is that congestion is typically
the norm rather than the exception, i.e. aggregate application demand will likely approach
or exceed network capacity frequently. As the mobile network is often simply an
extension of the fixed network infrastructure, mobile ad hoc users will demand similar
services. These demands will continue to increase as multimedia computing and
collaborative networking applications rise.

Energy-constrained operation: Some or all of the nodes in a MANET may rely on


batteries or other exhaustible means for their energy. For these nodes, the most important
system design criteriafor optimization may be energy conservation.

13
Limited physical security: Mobile wireless networks are generally more prone to
physical security threats than are fixed-cable nets. The increased possibility of
eavesdropping, spoofing, and denial-of-service attacks should be carefully considered.

Existing link security techniques are often applied within wireless networks to reduce
security threats. As a benefit, the decentralized nature of network control in MANETs
provides additional robustness against the single points of failure of more centralized
approaches.

14
ROUTING

A routing protocol is necessary, since two hosts that may wish to exchange
packets might not be able to communicate directly. For example, Figure illustrates a
simple ad hoc network of mobile hosts using wireless network interfaces. Host C is not
within the range of host A’s wireless transmitter and host A is not within the range of host
C’s wireless transmitter. If A and C wish to exchange packets, they may in this case enlist
the services of other hosts to forward packets for them. In this example they use the
services of three hosts to communicate. The maximum number of network hops needed
to reach another mobile host in any practical ad hoc network is likely to be small, but
may often be greater than one as shown here. The routing problem in a real ad hoc
network may be even more complicated than this example suggests, due to the inherent
non uniform propagation characteristics of wireless transmission, and since any or all of
the hosts involved may move at any time.

Host C

Host A

15
An Example of Routing

Routing protocols for ad hoc networks can generally be divided into two
categories.

A proactive (or periodic) routing protocol attempts to allow each node using it to always
maintain an up-to date route to each possible destination in the network; the protocol
periodically exchanges routing information with other nodes in order to allow new routes
to be discovered and existing routes to be modified if they break due to factors such as
node mobility and environmental changes.

Examples:

Link state Routing


DSDV – Destination Sequenced Distance Vector Routing

A reactive (or on-demand) routing protocol only attempts to a discover a route to some
destination when it has a packet to route to that destination and does not already know a
route there; the protocol caches known routes and uses a flooding based discovery
protocol when a needed route is not found in the cache. For dynamically mobile ad hoc
networks, reactive or on-demand routing protocols often outperform proactive or periodic
ones, due to their ability to adjust the amount of network overhead created to track the
mobility in the network affecting current communication.

Examples:
AODV – Ad hoc On Demand Distance Vector Routing
DSR – Dynamic Source Routing.

16
ROUTE DISCOVERY

When some source node originates a new packet addressed to some destination
node, the source node places in the header of the packet a "source route" giving the
sequence of hops that the packet is to follow on its way to the destination. Normally, the
sender will obtain a suitable source route by searching its "Route Cache" of routes
previously learned; if no route is found in its cache, it will initiate the Route Discovery
protocol to dynamically find a new route to this destination node. In this case, we call the
source node the "initiator" and the destination node the "target" of the Route Discovery.

For example, suppose a node A is attempting to discover a route to node E. The Route
Discovery initiated by node A in this example would proceed as follows:

^ "A" ^ "A,B" ^ "A,B,C" ^ "A,B,C,D"


| id=2 | id=2 | id=2 | id=2
+-----+ +-----+ +-----+ +-----+ +-----+
| A |---->| B |---->| C |---->| D |---->| E |
+-----+ +-----+ +-----+ +-----+ +-----+
| | | |
v v v v

Route Discovery

To initiate the Route Discovery, node A transmits a "Route Request" as a single local
broadcast packet, which is received by (approximately) all nodes currently within
wireless transmission range of A, including node B in this example. Each Route Request
identifies the initiator and target of the Route Discovery, and also contains a unique
request identification (2, in this example), determined by the initiator of the Request.

17
Each Route Request also contains a record listing the address of each intermediate node
through which this particular copy of the Route Request has been forwarded. This route
record is initialized to an empty list by the initiator of the Route Discovery. In this
example, the route record initially lists only node A.

When another node receives this Route Request (such as node B in this example), if it is
the target of the Route Discovery, it returns a "Route Reply" to the initiator of the Route
Discovery, giving a copy of the accumulated route record from the Route Request; when
the initiator receives this Route Reply, it caches this route in its Route Cache for use in
sending subsequent packets to this destination.

Otherwise, if this node receiving the Route Request has recently seen another Route
Request message from this initiator bearing this same request identification and target
address, or if this node's own address is already listed in the route record in the Route
Request, this node discards

the Request. Otherwise, this node appends its own address to the route record in the
Route Request and propagates it by transmitting it as a local broadcast packet (with the
same request identification). In this example, node B broadcast the Route Request, which
is received by node C; nodes C and D each also, in turn, broadcast the Request, resulting
in a copy of the Request being received by node E.

In returning the Route Reply to the initiator of the Route Discovery, such as in this
example, node E replying back to node A, node E will typically examine its own Route
Cache for a route back to A, and if found, will use it for the source route for delivery of
the packet containing the Route Reply. Otherwise, E SHOULD perform its own Route

18
Discovery for target node A, but to avoid possible infinite recursion of Route
Discoveries, it MUST piggyback this Route Reply on the packet containing its own
Route Request for A. It is also possible to piggyback other small data packets, such as a
TCP SYN packet, on a Route Request using this same mechanism.

Node E could instead simply reverse the sequence of hops in the route record that it is
trying to send in the Route Reply, and use this as the source route on the packet carrying
the Route Reply itself. For MAC protocols such as IEEE 802.11 that require a
bidirectional frame exchange as part of the MAC protocol [13], the discovered source
route MUST be reversed in this way to return the Route Reply since it tests the
discovered route to ensure it is bidirectional before the Route Discovery initiator begins
using the route; this route reversal also avoids the overhead of a possible second Route
Discovery.

However, this route reversal technique will prevent the discovery of routes using
unidirectional links, and in wireless environments where the use of unidirectional links is
permitted, such routes
may in some cases be more efficient than those with only bidirectional links, or they may
be the only way to achieve connectivity to the target node.

When initiating a Route Discovery, the sending node saves a copy of the original packet
(that triggered the Discovery) in a local buffer called the "Send Buffer". The Send Buffer
contains a copy of each packet that cannot be transmitted by this node because it does not
yet have a source route to the packet's destination. Each packet in the Send Buffer is
logically associated with the time that it was placed into the Send Buffer and is discarded
after residing in the Send Buffer for some timeout period; if necessary for preventing the
Send Buffer from overflowing, a FIFO or other replacement strategy MAY also be used
to evict packets even before they expire.

19
While a packet remains in the Send Buffer, the node SHOULD occasionally initiate a
new Route Discovery for the packet's destination address. However, the node MUST
limit the rate at which such new Route Discoveries for the same address are initiated,
since it is possible that the destination node is not currently reachable. In particular, due
to the limited wireless transmission range and the movement of the nodes in the network,
the network may at times become partitioned, meaning that there is currently no sequence
of nodes through which a packet could be forwarded to reach the destination. Depending
on the movement pattern and the density of nodes in the network, such network partitions
may be rare or may be common.

If a new Route Discovery was initiated for each packet sent by anode in such a
partitioned network, a large number of unproductive Route Request packets would be
propagated throughout the subset of the ad hoc network reachable from this node. In
order to reduce the overhead from such Route Discoveries, a node SHOULD use an
exponential back-off algorithm to limit the rate at which it initiates new Route
Discoveries for the same target, doubling the timeout between each successive Discovery
initiated for the same target. If the node attempts to send additional data packets to this
same destination node more frequently than this limit, the subsequent packets SHOULD
be buffered in the Send Buffer until a Route Reply is received giving a route to this
destination, but the node MUST NOT initiate a new Route Discovery until the minimum
allowable interval between new Route Discoveries for this target has been reached. This
limitation on the maximum rate of Route Discoveries for the same target is similar to the
mechanism required by Internet nodes to limit the rate at which ARP Requests are sent
for any single target IP address.

20
ROUTE MAINTENANCE

When originating or forwarding a packet using a source route, each node


transmitting the packet is responsible for confirming that data can flow over the link from
that node to the next hop. For example, in the situation shown below, node A has
originated a packet for node E using a source route through intermediate nodes B, C, and
D:

+-----+ +-----+ +-----+ +-----+ +-----+


| A |---->| B |---->| C |-->? | D | | E |
+-----+ +-----+ +-----+ +-----+ +-----+

Route Maintenance
In this case, node A is responsible for the link from A to B, node B is responsible for the
link from B to C, node C is responsible for the link from C to D, node D is responsible
for the link from D to E.

An acknowledgement can provide confirmation that a link is capable of carrying data,


and in wireless networks, acknowledgements are often provided at no cost, either as an
existing standard part of the MAC protocol in use (such as the link-layer
acknowledgement frame defined by IEEE 802.11), or by a "passive acknowledgement"
(in which, for example, B confirms receipt at C by overhearing C transmit the packet
when forwarding it on to D).

21
If a built-in acknowledgement mechanism is not available, the node transmitting the
packet can explicitly request a DSR-specific software acknowledgement be returned by
the next node along the route; this software acknowledgement will normally be
transmitted directly to the sending node, but if the link between these two nodes is
unidirectional, this software acknowledgement could travel over a different, multi-hop
path.

After an acknowledgement has been received from some neighbor, a node MAY choose
to not require acknowledgements from that neighbor for a brief period of time, unless the
network interface connecting a node to that neighbor always receives an
acknowledgement in response to unicast traffic.

When a software acknowledgement is used, the acknowledgement request SHOULD be


retransmitted up to a maximum number of times. A retransmission of the
acknowledgement request can be sent as a separate packet, piggybacked on a
retransmission of the original data packet, or piggybacked on any packet with the same
next-hop destination that does not also contain a software acknowledgement.

After the acknowledgement request has been retransmitted the maximum number of
times, if no acknowledgement has been received, then the sender treats the link to this
next-hop destination as currently "broken". It SHOULD remove this link from its Route
Cache and SHOULD return a "Route Error" to each node that has sent a packet routed
over that link since an acknowledgement was last received.

For example, in the situation shown above, if C does not receive an acknowledgement
from D after some number of requests, it would return a Route Error to A, as well as any
other node that may have used the link from C to D since C last received an
acknowledgement from D. Node A then removes this broken link from its cache; any

22
retransmission of the original packet can be performed by upper layer protocols such as
TCP, if necessary. For sending such a retransmission or other packets to this same
destination E, if A has in its Route Cache another route to E (for example, from
additional Route Replies from its earlier Route Discovery, or from having overheard
sufficient routing information from other packets), it can send the packet using the new
route immediately. Otherwise, it SHOULD perform a new Route Discovery for this
target.

23
DATA SECURITY

i) Message Encryption
ii) Message Decryption

DATA SECURITY USING RSA

24
 Source sends the encrypted data packet to the destination through the route
discovered.
 Destination decrypts the data packet received from the source and sends the
acknowledgement.

Input and Output Parameters

Input parameters
 At source, encrypted data packets are sent with destination address and route
request.

Output parameters
 Receiving positive acknowledgement with efficient and reliable packet
transmission.

25
ALGORITHM USED

DATA SECURITY USING RSA

 Source sends the encrypted data packet to the destination through the route discovered.
 Destination decrypts the data packet received from the source and sends the
acknowledgement.

26
KEY GENERATION:

i. Select two prime numbers p and q such that p


not equal to q.
ii. Calculate n=p x q
iii. Calculate ø (n)=(p-1)(q-1)
iv. Select integer e such that
gcd (ø(n),e)=1;1<e< ø (n)
v. Calculate d such that d=e¹mod ø(n)
vi. Public key KU={e,n}
vii. Private key KR={d,n}

ENCRYPTION:

The plain text M (M<n) is encrypted to cipher text using public key e.
C=M pow e (mod n)
DECRYPTION:

The cipher text C is decrypted to plain text using private key d.


M=C pow d (mod n)

ALGORITHM STEP BY STEP DESCRIPTION

1. If the user wants to send data:

o Get the Destination identifier and the encrypted data to be transferred.


o Initialize the buffer with the encrypted data to be transferred.

27
o Setup a Request Zone.
o Build a Route Request packet having the information about the source and
the Destination identifiers, and the Request Zone information.
o Broadcast the Route Request to its neighbors.
o Setup a timer for receiving Route Reply.

2. If the node receives a packet

o Find the type of the packet received.


o Depending on the type of packet received do one of the following
processes.
o Process Route Request.
o Process Route Reply.
o Process Data Packet.
o Process Decryption.
o Process Acknowledgement.
o Process Route Disconnect.
o Process Route Disconnect reply.
o Process Timer Run Out.

28
SOFTWARE REQUIREMENTS

Language : Java1.3

29
Front End Tool: Swing

Operating System: Windows 98.

HARDWARE REQUIREMENTS

Processor : Intel Pentium III Processor

Random Memory: 128MB

` Hard Disk :20GB

Processor Speed: 300 min

30
31
ARCHITECTURE
Location Aided Routing

Route discovery Route Maintenance

Find request zone and Retrieved route


send route request to path is not
all nodes in that zone found

Retrieve route
path from
destination

Send & receive data


using that path

32
Get Destination IP and
data

Setup Request Zone

Setup a timer and Send


Route Request

33
Process Route Request :

Yes
IS this Send Route Replay
the target
node?

No

Yes
Is it Discard
looping
?

No

Yes
Is it not
Discard
within the
Request
zone?

Send Route Request


to all neighbors

34
Process Route Reply:

Is this the Send Route Replay to


target node? next node

Record the
path?

Set the first entry as the


current path

Setup a timer and


Send Data packet along
the current path

35
Process Data Packets:

No
Is it the Send Data packet
target node? to next node

Yes

Yes
Is it the Record the data
expected
node?

No

Send the
corresponding Data
Acknowledgement

36
No
Is it the Send Data
target mode? Acknowledgement to next
node

Yes

No
Is it the expected Setup a timer & send
acknowledgement? previous Data Packet

Yes

Is there No
anymore data? Discard

Yes

Setup a timer and send


next Data Packet

37
No
Send Route Disconnect
Is it the target
to next node
node?

Yes

Clear the Buffer

Setup a timer and send Route


Disconnect Reply

38
No
Is this the Send Route
target Disconnect to
node? next node

Yes

Clear the Buffer

39
Process Timer Run Out:

Delete current path

No
Set the next path as
Is Route Table
current path
empty?

Yes

Calculate new Request Zone

Setup a timer and Send Route


Request

Resume the suspended process

40
41
This project is divided into 2 modules.

1.password module
2.request module

1.password module:

This module authenticates the user to enter.The user can type the text they want to send
or browse the file they want to attach .this message is transferred to the destination after
the data is encrypted.RSA algorithm is used for encryption.

2.Request module:

this module describes the wireless network communication protocol


mechanism .

42
43
SOURCE CODE
Password.java
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPasswordField;
import javax.swing.JTextField;
import java.sql.*;

public class Password extends JFrame implements ActionListener


{
JPasswordField password;
JTextField Text1;
JLabel login,pass,hea1;
JButton ok,cancel;
final String log = "routing";
final String passW = "location";
JFrame fpass;

Password()

44
{

fpass = new JFrame("Login");

fpass.getContentPane().setLayout(null);

hea1 = new JLabel("LOG IN SCREEN");


login = new JLabel("USER-ID");
Text1 = new JTextField(10);
pass = new JLabel("PASSWORD");
password = new JPasswordField(10);
ok = new JButton("OK");
cancel = new JButton("CANCEL");

hea1.setBounds(130,10,100,50);
login.setBounds(70,40,70,50);
Text1.setBounds(157,55,125,20);
pass.setBounds(70,70,70,50);
password.setBounds(158,83,125,20);
ok.setBounds(80,130,90,20);
cancel.setBounds(180,130,110,20);

fpass.getContentPane().add(hea1);
fpass.getContentPane().add(login);
fpass.getContentPane().add(Text1);
fpass.getContentPane().add(pass);
fpass.getContentPane().add(password);
fpass.getContentPane().add(ok);

45
fpass.getContentPane().add(cancel);

ok.addActionListener(this);
cancel.addActionListener(this);

fpass.setSize(400, 250);
fpass.setVisible(true);

}
public void actionPerformed(ActionEvent e)
{
String s = e.getActionCommand();
if(s.equals("OK"))
{

////

try
{
int count = 1;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con =
DriverManager.getConnection("Jdbc:Odbc:connection");
Statement st=con.createStatement();
String str = "select * from login";
ResultSet rs = st.executeQuery(str);
while(rs.next())
{

46
if(((Text1.getText()).equals(rs.getString(1))) &&
((password.getText()).equals (rs.getString(2))))
{
count = 0;
break;
}

else
count = 1;
}

if(count ==1)
{

JOptionPane.showMessageDialog(null, "Invaild
UserName and PassWord","Alert", JOptionPane.ERROR_MESSAGE);
Text1.setText("");
password.setText("");
fpass.setVisible(true);
}

else
{

fpass.setVisible(false);
Sender sen=new Sender();

47
}catch(Exception e1){System.out.println(e1);}
////

}
else if(s.equals("CANCEL"))
{
System.exit(0);
}
}
public static void main(String ar[])
{
Password ps = new Password();
ps.addWindowListener( new WindowAdapter()
{
public void windowClosing(WindowEvent
e)
{
System.exit(0);
}
}
); //addWindowListener

}//main method
}

48
Sender.java

import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import java.util.*;

class Sender implements ActionListener


{

JFrame jf;
static JTextArea jta=new JTextArea();
JButton jb,browse;
JTextField jt1,jt2,jt3;
JLabel jl1,jl2,jl3,jl4;
JScrollPane jsp;
Container c;
static String destination="";
static String ttt;
static String tte;
static Vector vvv=new Vector();
static int i=0;

Sender()
{

jf=new JFrame("Sender");
jb=new JButton("Send");
jt1=new JTextField();
jt2=new JTextField();
jt3=new JTextField();
jl1=new JLabel("Destination");
browse=new JButton("Browse");
jl2=new JLabel("Request Zone Limit");
jsp=new
JScrollPane(jta,ScrollPaneConstants.VERTICAL_SCROLLBAR_ALWAYS,ScrollPane
Constants.HORIZONTAL_SCROLLBAR_AS_NEEDED);

jf.setSize(800,800);
c=jf.getContentPane();

49
c.setLayout(null);
c.add(jsp);
c.add(jb);
c.add(browse);
c.add(jt1);
c.add(jl1);
c.add(jl2);
jsp.setBounds(100,100,400,400);
jb.setBounds(550,350,100,25);
jt1.setBounds(550,150,100,25);
browse.setBounds(550,250,100,25);
jl1.setBounds(550,100,100,25);
jb.addActionListener(this);
browse.addActionListener(this);
jf.setVisible(true);

public void actionPerformed(ActionEvent ae)

destination=jt1.getText();
ttt=jta.getText();

try
{
FileOutputStream fop=new FileOutputStream("msg.txt");
fop.write(ttt.getBytes());
ObjectOutputStream oop=new ObjectOutputStream(fop);
}
catch(Exception e){}
// vvv.add(ttt);
System.out.println("The vect size is "+vvv.size());
if(jb==ae.getSource())
{
try
{
System.out.println("The String sent is :"+ttt);
RSAKey rsa=new RSAKey();
}
catch(Exception e)
{
System.out.println("Error : "+e);
}

50
}
if((JButton)browse==ae.getSource())
{
JFileChooser fc = new JFileChooser();
int option = fc.showOpenDialog(jf);
if(option == JFileChooser.APPROVE_OPTION)
{
try
{
String
sf=fc.getSelectedFile().getAbsolutePath();
FileInputStream in = new
FileInputStream(sf);
byte str[] = new byte[in.available()];
in.read(str,0,str.length);
jta.setText(new String (str));
}
catch(Exception e){}
}
}
}

public static void Socket2(int y,String tt)throws Exception


{
FileInputStream fis=new FileInputStream("path"+y+".txt");
ObjectInputStream ois=new ObjectInputStream(fis);
Vector d=(Vector)ois.readObject();
int siz=d.size();
System.out.println("The size of the vector is ::"+siz);
for(int j=0;j<siz;j++)
{
System.out.print("++__++-->>"+d.get(j));

}
if(siz==2)
{

Socket soc=new Socket((String)d.get(1),8888);


ObjectOutputStream oos=new
ObjectOutputStream(soc.getOutputStream());
oos.writeObject("file");
oos.writeObject(tt);

51
}
else
{
d.removeElementAt(0);
int m=d.size();
System.out.println("The size after removing the element..."+m);
Socket soc=new Socket((String)d.get(1),8888);
ObjectOutputStream oos=new
ObjectOutputStream(soc.getOutputStream());
oos.writeObject("file++");
oos.writeObject(tt);
oos.writeObject(d);

}
}

52
RSA KEY.java

import javax.swing.*;
import java.awt.event.*;

class RSAKey implements ActionListener


{
JButton jb,jb1,jb2;
JFrame jf;

RSAKey()
{
jf=new JFrame("RSA KEY");
JInternalFrame jf1=new JInternalFrame("KEY Value");
//JLabel jl=new JLabel("Exponent Value:");
//JLabel jl1=new JLabel("N Value:");
//JPasswordField jt=new JPasswordField();
//JPasswordField jt1=new JPasswordField();
jb=new JButton("RSAKeyGen");
jb1=new JButton("Send");
jb2=new JButton("Exit");
JPanel jp=new JPanel();
JPanel jp1=new JPanel();
//jp.add(jl);
//jp.add(jl1);
//jp.add(jt);
//jp.add(jt1);
jp.add(jb);
jp.add(jb1);
jp.add(jb2);
jb.addActionListener(this);
jb1.addActionListener(this);
jb2.addActionListener(this);
jp.setLayout(null);
//jl.setBounds(40,60,100,25);
//jt.setBounds(150,60,100,25);
//jl1.setBounds(40,90,100,25);
//jt1.setBounds(150,90,100,25);
jb.setBounds(90,100,120,25);
jb1.setBounds(50,180,75,25);

53
jb2.setBounds(140,180,75,25);
jf1.setContentPane(jp);
jp1.setLayout(null);
jf1.setBounds(30,30,180,180);
jf1.setVisible(true);
jf.setContentPane(jf1);
jf.setSize(300,300);
jf.setVisible(true);
}

public void actionPerformed(ActionEvent ae)


{
if(ae.getSource()==jb)
{
RSAKeyDsgn rsad=new RSAKeyDsgn();
}
if(ae.getSource()==jb1)
{
try
{
new Timers();
jf.setVisible(false);
EnRSA en=new EnRSA();
en.WriteRSA(keyrsa1.d,keyrsa1.n);
}
catch(Exception ex){}
}
if(ae.getSource()==jb2)
{
//System.exit(0);
jf.setVisible(false);
}
}
public static void main(String arg[])
{
RSAKey rsa=new RSAKey();
}
}

54
RSAKeyDesgn.java

import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.io.FileInputStream;
import java.io.*;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
import javax.swing.*;

public class RSAKeyDsgn extends JFrame implements ActionListener


{
private JLabel pval,qval,rsa;
private JTextField pfield,qfield;
private JButton ok,cancel;
String pstr,qstr;
JFrame frsa;

RSAKeyDsgn()
{

frsa = new JFrame("RSA KeyGeneration");


JPanel jp=new JPanel();
jp.setLayout(null);
rsa = new JLabel("RSA KEYGENERATION");
pval = new JLabel("First Prime Number (P)");
qval = new JLabel("Second Prime Number (Q)");
pfield = new JTextField(20);
qfield = new JTextField(20);
ok = new JButton("OK");
cancel = new JButton("CANCEL");
jp.add(pval);
jp.add(qval);

55
jp.add(pfield);
jp.add(qfield);
jp.add(ok);
jp.add(cancel);

rsa.setBounds(140,20,140,20);
pval.setBounds(45,55,150,20);
pfield.setBounds(210,55,150,20);
qval.setBounds(45,90,150,20);
qfield.setBounds(210,90,150,20);
ok.setBounds(110,150,90,20);
cancel.setBounds(210,150,90,20);
frsa.setContentPane(jp);

ok.addActionListener(this);
cancel.addActionListener(this);

frsa.setSize(450,250);
frsa.setVisible(true);
frsa.addWindowListener( new WindowAdapter()
{
public void windowClosing(WindowEvent e)
{
frsa.setVisible(false);
}
}
);
}

public void actionPerformed(ActionEvent arg0)


{
if(arg0.getSource()==ok)
{
pstr=pfield.getText();
qstr=qfield.getText();
try
{
if(Integer.parseInt(pstr) >=100 || Integer.parseInt(qstr) >=100)
{
JOptionPane.showMessageDialog(null,"You Have Entered
into HIGH LEVEL TRUST ","LEVEL OF
TRUST",JOptionPane.INFORMATION_MESSAGE);
try{
FileOutputStream fos=new FileOutputStream("trust");
ObjectOutputStream oos=new ObjectOutputStream(fos);
oos.writeObject("high");}

56
catch(Exception e){}
}
else if(Integer.parseInt(pstr) >=25 || Integer.parseInt(qstr) >=25)
{
JOptionPane.showMessageDialog(null,"You Have Entered
into MEDIUM LEVEL TRUST ","LEVEL OF
TRUST",JOptionPane.INFORMATION_MESSAGE);
try{
FileOutputStream fos=new FileOutputStream("trust.txt");
ObjectOutputStream oos=new ObjectOutputStream(fos);
oos.writeObject("medium");}
catch(Exception e){}
}
else
{
JOptionPane.showMessageDialog(null,"You Have Entered
into LOW LEVEL TRUST ","LEVEL OF
TRUST",JOptionPane.INFORMATION_MESSAGE);
try{
FileOutputStream fos=new FileOutputStream("trust");
ObjectOutputStream oos=new ObjectOutputStream(fos);
oos.writeObject("low");}
catch(Exception e){}
}
FileInputStream fis=new FileInputStream("msg.txt");
byte str[]=new byte[fis.available()];
fis.read(str,0,str.length);
String str1=new String(str);
System.out.println(str1);
keyrsa1 k1=new keyrsa1(str1);
k1.Key(pstr,qstr);
frsa.setVisible(false);
}
catch(Exception ew){}
}
}
}

57
EnRSA.java

import java.io.BufferedInputStream;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.*;
import java.net.*;
import javax.swing.JOptionPane;

public class EnRSA


{
static String s,str="",ch="";
long e,n,c,f,data;
int k,i;
String estr,nstr;
public void GetRSA(long es, long ns,String s) throws IOException
{
System.out.println(s);
byte b[]=s.getBytes();
FileOutputStream fos=new FileOutputStream("data1.txt");
fos.write(b);
e=es;
n=ns;
FileInputStream file=new FileInputStream("data1.txt");
System.out.println("The value for e :"+e);
System.out.println("The value of n :"+n);

while((data=file.read())!=-1)
{
if(Math.max(data,n) == data)
{
JOptionPane.showMessageDialog(null,"To Encrypt Message is
too Big, must (Message < n)","Error",1);
System.exit(0);
}

58
if ( e % 2 == 0)
{

c = 1;
for ( i = 1; i <= e/2; i++)
{
f = (data*data) % n;
c = (f*c) % n;
}
}
else
{

c = data;
for ( i = 1; i <= e/2; i++)
{
f = (data*data) % n;
c = (f*c) % n;
}

}
k=(int)c;
str=Long.toString(c);
ch=ch+str+" ";

}
System.out.println(ch);
file.close();
}

public void WriteRSA(long d,long n) throws IOException


{
try
{
String s=d+"";
String s1=n+"";
FileWriter put = new FileWriter("rsain.txt");
put.write(ch);
put.close();
System.out.println("Destination Name:"+Sender.destination);
Send.send(Sender.destination);

59
}
catch(Exception es){}
}

60
DERSA.java

import java.io.BufferedReader;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.io.*;

public class DERSA


{

static String s,sn1="";


int info[] = {48,49,50,51,52,53,54,55,56,57};
long a[] = {0,1,2,3,4,5,6,7,8,9};
long d,n,g,f,value,temp=0;
int k,l=0,data,i;
char c[] = new char[1000];
String dstr,nstr;

public void ProcessDecrp(long ds,long ns,String sn) throws IOException


{
d=ds;
n=ns;
byte b[]=sn.getBytes();
FileOutputStream fos=new FileOutputStream("rsain.txt");
fos.write(b);
FileInputStream f0=new FileInputStream("rsain.txt");
FileOutputStream put = new FileOutputStream("Output.txt");
while((data=f0.read()) != -1)
{
System.out.println("Data:"+data);
value=0;
for(i=0;i<info.length;i++)
{
if(data==info[i])
temp=a[i];
}
value=(value*10)+temp;
data=f0.read();

while(data!=32)

61
{
for(i=0;i<info.length;i++)
{
if(data==info[i])
temp=a[i];
}
value=(value*10)+temp;
data=f0.read();
}

if ( d % 2 == 0)
{
g = 1;
for ( i = 1; i <= d/2; i++)
{
f = (value*value) % n;
g = (f*g) % n;
System.out.println("if:"+g);
}
}
else
{
g = value;
for ( i = 1; i <= d/2; i++)
{
f = (value*value) % n;
g = (f*g) % n;
System.out.println("else:"+g);
}
}
char k1=(char)g;
sn1=sn1+k1;
put.write(sn1.getBytes());
}
Recv.ja.setText(sn1);
put.close();
}

62
Recv.java

import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;

class Recv implements ActionListener


{
JFrame jf;
static JTextArea ja;
JButton jb;
JLabel jl;
JScrollPane jsp;
static String sr,sr1,sr2;
static long d,n;
Recv()
{
jf=new JFrame("Receiver");
jl=new JLabel("Receive the Message");
ja=new JTextArea();
jsp=new JScrollPane(ja);
jb=new JButton("Receive");
JPanel jp=new JPanel();
jp.add(jb);
jp.add(jsp);
jp.add(jl);
jb.addActionListener(this);
jp.setLayout(null);
jl.setBounds(40,60,150,25);
jsp.setBounds(40,90,250,300);
jb.setBounds(100,420,100,25);
jf.setContentPane(jp);
jf.setSize(350,500);
jf.setVisible(true);
}

63
public void actionPerformed(ActionEvent ae)
{
if((JButton)jb==ae.getSource())
{
RSAKeyDecry dn=new RSAKeyDecry();
}
}

64
Req.java

import java.net.*;
import java.util.*;
import java.io.*;
import javax.swing.*;

public class Req


{

static Socket s1,s2,d;


static Vector localvect=new Vector(10);
static Vector localvecttemp=new Vector(10);
static Vector recvect=new Vector(10);
static int i=0;
static String file="";
static Vector vv=new Vector();
static String mm;
static String tte;
static Sender sen;
static String jdd;
static String dd;

public static void main(String a[]) throws Exception


{

String path="";
Enumeration it;
String sender="";
String localaddr=(InetAddress.getLocalHost()).getHostName();
String destination="";
Socket s1,s2,d;
String sockaddr="";
String next="";
int vectsize;

65
try
{

ServerSocket ss=new ServerSocket(8888);


new tab();
while(true)
{
System.out.println("Connected ");
tab.setTable("Connected ");

System.out.println(localaddr+" is Waiting....... ");


tab.setTable(localaddr+" is Waiting....... ");
Socket s=ss.accept();
InputStream ins=s.getInputStream();
OutputStream ous=s.getOutputStream();
ObjectOutputStream oos=new ObjectOutputStream(ous);
ObjectInputStream ois=new ObjectInputStream(ins);
FileReader fr=new FileReader("nextnodes.txt");
BufferedReader br=new BufferedReader(fr);
String fd=(String)ois.readObject();
if(fd.equals("reqroute"))
{
System.out.println("Route Request...");
tab.setTable("Route Request...");
localvect=(Vector)ois.readObject();
sender=(String)localvect.firstElement();
System.out.println("The Sender address is :
"+sender);
tab.setTable("The Sender address is : "+sender);
destination=(String)localvect.get(1);
System.out.println("The Destined address is :
"+destination);
tab.setTable("The Destined address is :
"+destination);
System.out.println("The Local Address is :
"+localaddr);
tab.setTable("The Local Address is : "+localaddr);
if(destination.equalsIgnoreCase(localaddr))
{
req(localvect);
}

66
else
{
while((next=br.readLine())!=null)
{

try
{
s1=new Socket(next,8888);
OutputStream ous1=s1.getOutputStream();
ObjectOutputStream oos3=new
ObjectOutputStream(ous1);
localvect.addElement(localaddr);
oos3.writeObject("reqroute");
oos3.writeObject(localvect);
}
catch(Exception e)
{
System.out.println("Error in
file "+e);
tab.setTable("Error in file "+e);
}

}
}

else if(fd.equals("ack"))
{
Timers.rece();
System.out.println("Acknowledgement from
destination ...");
tab.setTable1("Acknowledgement from
destination ...");
localvect=(Vector)ois.readObject();
it=localvect.elements();
while(it.hasMoreElements())
{
path=(String)it.nextElement();
System.out.print(" "+path+" --> ");
tab.setTable1(" "+path+" --> ");
}

67
System.out.println();

if(((String)localvect.firstElement()).equalsIgnoreCase(localaddr))
{
i++;
System.out.println("Acknowledgement sent
from the destination ....");
tab.setTable1("Acknowledgement sent from
the destination ....");
System.out.println("The sender can send the
data now....");
tab.setTable1("The sender can send the data
now....");
String destin=(String)localvect.remove(1);
localvect.add(destin);
it=localvect.elements();
System.out.println("Source ");
tab.setTable1("Source ");
System.out.println("The path from source to
destination is as follows :");
tab.setTable1("The path from source to
destination is as follows :");
while(it.hasMoreElements())
{
path=(String)it.nextElement();
System.out.println(" "+path+" --> ");
tab.setTable1(" "+path+" --> ");

}
new Store_Path(i,localvect);
Store_Path.file();
System.out.println(" Destination ");
tab.setTable1(" Destination ");
Socket1();

else
if(((String)localvect.get(2)).equalsIgnoreCase(localaddr))
{

localvect.remove(localvect.size()-1);

68
s2=new
Socket((String)localvect.firstElement(),8888);
OutputStream os2=s2.getOutputStream();
ObjectOutputStream ous2=new
ObjectOutputStream(os2);
ous2.writeObject("ack");
FileOutputStream foo=new
FileOutputStream("paths.txt");
ObjectOutputStream oopp=new
ObjectOutputStream(foo);
oopp.writeObject(localvect);
ous2.writeObject(localvect);
}

else

{
localvect.remove(localvect.size()-1);

sockaddr=(String)localvect.get(localvect.size()-1);
Enumeration en=localvect.elements();
System.out.println("The next system address is "+sockaddr);
tab.setTable1("The next system address is
"+sockaddr);
s2=new Socket(sockaddr,8888);
System.out.println("Intermediate node
"+localaddr+" forwarding the ack to "+sockaddr);
tab.setTable1("Intermediate node
"+localaddr+" forwarding the ack to "+sockaddr);
OutputStream os2=s2.getOutputStream();
ObjectOutputStream ous2=new
ObjectOutputStream(os2);
ous2.writeObject("ack");
ous2.writeObject(localvect);

}
}

else if(fd.equals("file++"))

{
i++;

69
String sub=(String)ois.readObject();
vv=(Vector)ois.readObject();
System.out.println("The String sent is "+sub);
new Store_Path(i,vv);
Store_Path.file();
Sender.Socket2(i,sub);
}
else if(fd.equals("file"))
{
JOptionPane.showMessageDialog(null,"File
Received","File",JOptionPane.INFORMATION_MESSAGE);
dd=(String)ois.readObject();
System.out.println("The message sent from source
is ::"+dd);
tab.setTable1("The message sent from source
is ::"+dd);
Recv re=new Recv();
FileInputStream pa=new
FileInputStream("paths.txt");
ObjectInputStream ooo=new
ObjectInputStream(pa);
Vector n=(Vector)ooo.readObject();
for(int h=0;h<n.size();h++)
{
System.out.println("The value inside vector
is "+n.get(h));
tab.setTable("The value inside vector is
"+n.get(h));
}
if(n.size()==2)
{
Socket ssp=new
Socket((String)n.get(0),8888);
ObjectOutputStream oop=new
ObjectOutputStream(ssp.getOutputStream());
oop.writeObject("ackfile");
oop.writeObject("The message \""+dd+"\"
has received by the destination "+(String)n.get(1));
}
else
{

70
Socket sss=new
Socket((String)n.lastElement(),8888);
n.removeElementAt(n.size()-1);
ObjectOutputStream oop1=new
ObjectOutputStream(sss.getOutputStream());
oop1.writeObject("ackfile1");
oop1.writeObject("The message \""+dd+"\"
has received by the destinaton "+(String)n.get(1));
oop1.writeObject(n);

}
else if(fd.equals("ackfile"))
{
jdd=(String)ois.readObject();
System.out.println(jdd);
tab.setTable1(jdd);
}
else if(fd.equals("ackfile1"))
{
String ds=(String)ois.readObject();
Vector vl=(Vector)ois.readObject();
if(vl.size()==2)
{
Socket sspd=new
Socket((String)vl.get(0),8888);
ObjectOutputStream oop=new
ObjectOutputStream(sspd.getOutputStream());
oop.writeObject("ackfile");
oop.writeObject(ds);

}
else
{
Socket ssj=new
Socket((String)vl.lastElement(),8888);
vl.removeElementAt(vl.size()-1);
ObjectOutputStream oop1=new
ObjectOutputStream(ssj.getOutputStream());
oop1.writeObject("ackfile1");
oop1.writeObject(ds);
oop1.writeObject(vl);

71
}

}
}

}
catch(Exception e)
{
System.out.println("Some Error has occurred : "+e);
tab.setTable("Some Error has occurred : "+e);
}

public static void req(Vector v)


{
String b="";
try
{
int o=v.size();
if(o==2)
{
b=(String)v.firstElement();
}
else
{
b=(String)(v.lastElement());
}
Enumeration en=v.elements();
while(en.hasMoreElements())
{
String f=(String)en.nextElement();
System.out.println("The path from source to destination :
"+f);
tab.setTable1("The path from source to destination : "+f);
}
d=new Socket(b,8888);
OutputStream os=d.getOutputStream();
ObjectOutputStream oos1=new ObjectOutputStream(os);
oos1.writeObject("ack");
String ss="";
localvect=v;

72
FileOutputStream foo=new FileOutputStream("paths.txt");
ObjectOutputStream oopp=new ObjectOutputStream(foo);
oopp.writeObject(localvect);
boolean boo=true;
if(o==2)
{}
else
{
for(int i=2;i<o;i++)
{
v.add((String)localvect.get(i));
}
}

oos1.writeObject(v);

}
catch(Exception e)
{
System.out.println("Error at ack sending in destination
"+e);
tab.setTable1("Error at ack sending in destination "+e);
}
}

public static void Socket1()throws Exception


{
System.out.println("Inside Socket1");
FileInputStream fip=new FileInputStream("rsain.txt");
byte str[]=new byte[fip.available()];
fip.read(str,0,str.length);
String tte=new String(str);
System.out.println("The mmm is :::"+tte);
FileInputStream fis=new FileInputStream("path1.txt");
ObjectInputStream ois=new ObjectInputStream(fis);
Vector d=(Vector)ois.readObject();
int siz=d.size();
System.out.println("The size of the vector is ::"+siz);
for(int j=0;j<siz;j++)
{
System.out.print("++__++-->>"+d.get(j));

73
}
if(siz==2)
{

Socket soc=new Socket((String)d.get(1),8888);


ObjectOutputStream oos=new
ObjectOutputStream(soc.getOutputStream());
oos.writeObject("file");
System.out.println("The string in the textbox ::"+tte);
oos.writeObject(tte);
}
else
{
d.removeElementAt(0);
int m=d.size();
System.out.println("The size after removing the element..."+m);
Socket soc=new Socket((String)d.get(1),8888);
ObjectOutputStream oos=new
ObjectOutputStream(soc.getOutputStream());
oos.writeObject("file++");
System.out.println("The string in the textbox ::"+tte);
oos.writeObject(tte);
oos.writeObject(d);

74
75
PassWord.Java (Sender Side)

Fig:Starting The Sender

76
Starting the Receiver to Listen Particular Port

77
Sender Data Entry Form for (Text / File)

78
RSA KEY Generation Form

79
1

Trust Level Display

80
KEY Generation Display

81
As soon as the file received the destination it gives the information like this

It is Mentioning that it has received Socket with Some content

if we are pressing the receive button in below it will be shown the message after getting
key.

82
The value of D and N Value has been entered by user

83
84
Finally Entered Information will be shown Here

85
Each and Every Transaction Will be Entered In this Table

If the Server has not been started then it indicates at sender

86
87
Gantt Chart

Task Jul Aug SEP OCT NOV

Analysis

v
Design

Implementation

Testing

Maintenance

88
89
CONCLUSION

The recent major trends of system modernization and


transition to net enabled technologies present a growing need for more
security in Data transfer. IT organizations are required to provide greater
security for the transformation of messages. Hence we provide security
using key Generation and Verification.

The proposed system has fully satisfied the following task:


 Low time consumption
 High Reliability
 Full control of source and target data definitions.
 Efficient utilization of effective utilizations
 High operational speed
 Less manual effort

The Project titled “LOCATION AIDED ROUTING


IN MOBILE ADHOC NETWORK” has been successfully completed
as per the requirements.

90
APPENDIX
JAVA

Java was designed to meet all the real world requirements with its key
features, which are explained in the following paragraph.

SIMPLE AND POWERFUL

Java was designed to be easy for the professional programmer to learn


and use efficiently. Java makes itself simple by not having surprising
features. Since it exposes the inner working of a machine, the programmer
can perform his desired actions without fear. Unlike other programming
systems that provide dozens of complicated ways to perform a simple task,
Java provides a small number of clear ways to achieve a given task.

91
SECURE

Today everyone is worried about safety and security. People feel that
conducting commerce over the Internet is a safe as printing the credit card
number on the first page of a Newspaper. Threatening of viruses and system
hackers also exists. To overcome all these fears java has safety and security
as its key design principle.

Using Java Compatible Browser, anyone can safely download java


applets without the fear of viral infection or malicious intent. Java achieves
this protection by confining a java program to the java execution
environment and by making it inaccessible to other parts of the computer.
We can download applets with confidence that no harm will be done and no
security will be breached.

92
PORTABLE

In java, the same mechanism that gives security also helps in portability.
Many types of computers and operating systems are in use throughout the
world and are connected to the internet. For downloading programs through
different platforms connected to the internet, some portable, executable code
is needed. Java’s answer to these problems is its well designed architecture.

OBJECT-ORIENTED

Java was designed to be source-code compatible with any other


language. Java team gave a clean, usable, realistic approach to objects. The
object model in java is simple and easy to extend, while simple types, such
as integers, are kept as high-performance non -objects.

93
DYNAMIC

Java programs carry with them extensive amounts of run-time


information that is used to verify and resolve accesses to objects at run-time.
Using this concept it is possible to dynamically link code. Dynamic property
of java adds strength to the applet environment, in which small fragments of
byte code may be dynamically updated on a running system.

NEWLY ADDDED FEATURES IN JAVA 2

 SWING is a set of user interface components that is entirely


implemented in java the user can use a look and feel that is either
specific to a particular operating system or uniform across operating
systems.

 Collections are a group of objects. Java provides several types of


collection, such as linked lists, dynamic arrays, and hash tables, for
our use. Collections offer a new way to solve several common
programming problems.

 Various tools such as javac, java and javadoc have been enhanced.
Debugger and profiler interfaces for the JVM are available.

 Performance improvements have been made in several areas. A


JUST-IN-TIME (JIT) compiler is included in the JDK.

94
 Digital certificates provide a mechanism to establish the identity of a
user, which can be referred as electronic passports.

 Various security tools are available that enable the user to create the
user to create and store cryptographic keys ad digital certificates, sign
Java Archive(JAR) files, and check the signature of a JAR file.

SWING

Swing components facilitate efficient graphical user interface


(GUI) development. These components are a collection of lightweight
visual components. Swing components contain a replacement for the
heavyweight AWT components as well as complex user interface
components such as Trees and Tables.

Swing components contain a pluggable look and feel (PL & F).
This allows all applications to run with the native look and feel on
different platforms. PL & F allows applications to have the same
behaviour on various platforms. JFC contains operating system neutral
look and feel. Swing components do not contain peers. Swing
components allow mixing AWT heavyweight and Swing lightweight
components in an application.

95
The major difference between lightweight and heavyweight
components is that lightweight components can have transparent pixels
while heavyweight components are always opaque. Lightweight
components can be non-rectangular while heavyweight components are
always rectangular.

Swing components are JavaBean compliant. This allows


components to be used easily in a Bean aware application building
program. The root of the majority of the Swing hierarchy is the
JComponent class. This class is an extension of the AWT Container
class.

Swing components comprise of a large percentage of the JFC


release. The Swing component toolkit consists of over 250 pure Java
classes and 75 Interfaces contained in about 10 Packages. They are used
to build lightweight user interfaces. Swing consists of User Interface (UI)
classes and non- User Interface classes. The non-User Interface classes
provide services and other operations for the UI classes.

96
Swing offers a number of advantages, which include

 Wide variety of Components


 Pluggable Look and Feel
 MVC Architecture
 Keystroke Handling
 Action Objects
 Nested Containers
 Virtual Desktops
 Compound Borders
 Customized Dialogues
 Standard Dialog Classes
 Structured Table and Tree Components
 Powerful Text Manipulation
 Generic Undo Capabilities
 Accessibility Support

97
REFERENCES

1. Herbert Schildt, Edition (2003) ‘The Complete Reference JAVA 2’


Tata McGraw Hill Publications .

2. Michael Foley and Mark McCulley, Edition(2002) ‘JFC Unleashed’


Prentice-Hall India.

3. Andrew S Tanenbaum, Edition(2003) ‘ Computer Networks ’

98

You might also like