14
129 Manjunath K, Dr.Nalini N International Journal of Innovations & Advancement in Computer Science IJ IACS ISSN 2347 8616 Volume 3, Issue 4 June 2014 IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS FOR WIRELESS SENSOR NETWORKS Manjunath K M.Tech, Dept. CSE NMIT Bangalore , India Dr.Nalini N Prof., Dept. CSE NMIT Bangalore , India Abstract . Application of Wireless sensor network (WSN) is increasing in a rapid speed. As sensor networks may interact with sensitive data and operate in hostile unattended environments, it is imperative that security concern be addressed from the beginning of the system. But sensor networks also introduce severe resource constraints due to their lack of data storage and power. Data encryption is widely used to ensure security in open networks such as the internet. the capabilities of cryptosystems such as of RSA and Diffie-Hellman are inadequate due the requirement of large number of bits. This paper presents the comparison and implementation of RSA and ECC for establishing secure connection in wireless sensor networks. At lower key bit size ECC provide same level of security as RSA. That is ECC is an excellent choice for asymmetric cryptography in portable constrained devices. 1024-bit RSA key provides the same level of security as a160-bit elliptic curve key[19]. Here we have simulated the protocols in NS2.35 platform Key wordswireless sensor networks, clustering, RSA, ECC I. INTRODUCTION Wireless sensor networks are quickly gaining popularity due to the fact that they are potentially low cost solutions to a variety of real-world challenges [1]. Their low cost provides a means to deploy large sensor arrays in a variety of conditions capable of performing both military and civilian tasks. Wireless sensor networks are large scale, usually slow moving or static wireless ad-hoc networks. Sensor networks are composed of thousands or millions of small nodes (motes) designed to sense environment and collect data. The motes are usually organized into clusters where each cluster is connected to a more powerful base station (BS). These networks have many practical applications which include military use, rescue operations, monitoring and tracking, etc [2]. RSA (Rivest, Shamir & Adleman) is asymmetric cryptographic algorithm developed in 1977. It generates two keys: public key for encryption and private key to decrypt message [3].RSA algorithm consist of three phases, phase one is key generation which is to be used as key to encrypt and decrypt data, second phase is encryption, where actual process of conversion of plaintext to cipher text is being carried out and third phase is decryption, where encrypted text is converted in to plain text at other side. As a public key is used for encryption and is well known to everyone and with the help of public key, hacker can use brute force method to find private key which is used to decrypt message. Secure RSA prevents files from hackers and help safe transmission of files from one end to other [3].

IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

129 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

IMPLEMENTATION OF RSA AND ECC SECURITY

PROTOCOLS FOR WIRELESS SENSOR NETWORKS

Manjunath K

M.Tech, Dept. CSE

NMIT Bangalore , India

Dr.Nalini N

Prof., Dept. CSE

NMIT Bangalore , India

Abstract. Application of Wireless sensor network (WSN) is increasing in a rapid speed.

As sensor networks may interact with sensitive data and operate in hostile unattended environments, it is imperative that security

concern be addressed from the beginning of the system. But sensor networks also introduce

severe resource constraints due to their lack of data storage and power. Data encryption is widely used to ensure

security in open networks such as the internet. the capabilities of cryptosystems such as of

RSA and Diffie-Hellman are inadequate due the requirement of large number of bits. This paper presents the comparison and implementation of

RSA and ECC for establishing secure connection in wireless sensor networks. At

lower key bit size ECC provide same level of security as RSA. That is ECC is an excellent choice for asymmetric cryptography in portable

constrained devices. 1024-bit RSA key provides the same level of security as a160-bit elliptic

curve key[19]. Here we have simulated the protocols in NS2.35 platform

Key words— wireless sensor networks, clustering, RSA, ECC

I. INTRODUCTION

Wireless sensor networks are quickly gaining popularity due to the fact that they are

potentially low cost solutions to a variety of real-world challenges [1]. Their low cost

provides a means to deploy large sensor arrays in a variety of conditions capable of performing

both military and civilian tasks. Wireless sensor networks are large scale, usually slow moving or static wireless ad-hoc networks. Sensor

networks are composed of thousands or millions of small nodes (motes) designed to sense

environment and collect data. The motes are usually organized into clusters where each cluster is connected to a more powerful base

station (BS). These networks have many practical applications which include military

use, rescue operations, monitoring and tracking, etc [2].

RSA (Rivest, Shamir & Adleman) is asymmetric cryptographic algorithm developed

in 1977. It generates two keys: public key for encryption and private key to decrypt message [3].RSA algorithm consist of three phases, phase

one is key generation which is to be used as key to encrypt and decrypt data, second phase is

encryption, where actual process of conversion of plaintext to cipher text is being carried out and third phase is decryption, where encrypted

text is converted in to plain text at other side. As a public key is used for encryption and is well

known to everyone and with the help of public key, hacker can use brute force method to find private key which is used to decrypt message.

Secure RSA prevents files from hackers and help safe transmission of files from one end to

other [3].

Page 2: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

130 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

The use of elliptic curves in public key cryptography was independently proposed by

Koblitz and Miller in 1985 [5] and since then, an enormous amount of work has been done on elliptic curve cryptography. The attractiveness

of using elliptic curves arises from the fact that similar lever of security can be achieved with

considerably shorter keys than in methods based on the difficulties of solving discrete logarithms over integers or integer factorizations

Elliptic curve cryptography(ECC) makes use of elliptic curves in which the variables and

coefficients are all restricted to elements of a finite field. For the interest of the readers, it is

said that Elliptic curves are not ellipses. In ECC we normally start with an affine point called Pm(x,y). These points may be the Base point (G)

itself or some other point closer to the Base point. Base point implies it has the smallest (x,y)

co-ordinates, which satisfy the EC A character in a message is first transformed into an affine point of the elliptic curve by using

it as a multiplier of Pm. That is, if 'a' is a scalar value representing the ASCII value of a text

character, then we determine Pml= a * Pm. The newly evaluated Pml is a point on the EC, determined by applying the scalar multiplication

on the EC points. The multiplication of the points are implemented by the repeated

addition and doubling strategy of ECC technique. Then as per ECC algorithm, Pml is added with KPB, where 'k' is randomly chosen

large secret integer and PB is the public key of user B, which is also a point EC field to yield

(Pml +kPB). This now constitutes second part of the encrypted version of the message. The other part, namely, kG, which is the product of

the secret integer and the Base point, constitutes the first part. Thus the encrypted message is

now made up of two sets of coordinates, namely (kG, Pml + kPB).

Now to recover the information from the encrypted version, first we apply the decryption

process of ECC, by applying the private key of recipient (nB) on the first element (kG). This is

subtracted from the second element to recover Pml. Lastly by using the discrete logarithm

concept, it is possible to evaluate the ASCII value and thereby recover the plaintext. Hence the keys are transformed over the EC field for

both encryption and decryption. This promises to afford maximum security from intruders and

hackers

II. Security Goals

We focus on the following basic security goals:

(i).Confidentiality: Many application of sensor network, such as military monitoring, required secured sensor data so that they cannot be

disclosed to the attackers. This is the main goal of our security protocol.

(ii). Integrity: It guarantees that if an adversary modifies a data message from an authentic sender, the receiver should be able to detect that

tempering. (iii).Authenticity: It ensures that the data

messages come from an intended sender.

III..RELATED WORK

A) RSA

In this paper we try to model a scenario which

will lessen the cost of RSA [4] security protocol. We have taken three steps to lessen the energy consumption of RSA security protocol.

Firstly, we have design a model for secured data communication from cluster node to cluster

head. Secondly, we have modified the RSA algorithm to reduce the computation cost and thirdly we have changed the packet format. In

our scenario we have taken initial power, transmission and receiving range is same for the

entire cluster node and the cluster head as well. When the sensor nodes are deployed, they make a cluster within their range. Each cluster

has a cluster head and other node in the cluster is called cluster node. It is the duties of these

cluster head to communicate with the base station of the network .which is depicted in Figure 1

Page 3: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

131 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

Figure1: Cluster formation

The RSA algorithm involves three steps: key

generation, encryption and decryption.

a)Key generation

RSA involves a public key and a private key.

The public key can be known to everyone and is

used for encrypting messages. Messages encrypted with the public key can only be

decrypted using the private key which is known to the user only. The keys for the RSA algorithm are generated the following way:

1) Select random prime numbers p and q, and check that p != q For security purposes,

the integers p and q should be chosen uniformly at random and should be of similar bit-length. Prime integers can be efficiently found using a

primary test. 2). Compute modulus n = pq

n is used as the modulus for both the public and private keys

3)Compute phi, φ(pq)= (p - 1)(q - 1) 4) Choose an integer e such that 1 < e <

φ(pq), and e and φ(pq) share no divisors other than 1 i.e., e and φ(pq) are coprime (gcd(e, φ) = 1) e is released as the public key exponent e

having a short bit-length and small Hamming weight results in more efficient encryption.

However, small values of e (such as e = 3) have been shown to be less secure in some settings. 5) Determine d (using modular arithmetic)

which satisfies the congruence relation de=1 (mod φ( pq )) or d = e-1 mod φ or we can say

differently, ed − 1 can be evenly divided by the totient (p − 1)(q − 1). This is often computed

using the extended Euclidean algorithm. d is kept as the private key exponent.

Figure 2: Communication model from Cluster

Node to Base Station

In our scenario the base station broadcasts its

public key in the network of its range. The entire cluster head stores the public key of the base

station in its memory. Each cluster head generates two different large distinct prime numbers p and q. Then using these i.e p and q

,the cluster head generates a public key suite (e, n) and a private key suite (d, n).After generating

the public and private key pair, cluster heads send their corresponding private key encrypted by the public key of the base station. The base

station decrypts those messages sent by the cluster heads with its private key and gets the

private key of all the cluster heads which want to communicate with it. Each cluster head broadcasts its public key to the cluster, it

resides, periodically. After getting the public key of its cluster head, the cluster node stores it

in its memory. It uses the public key for encrypting the message whenever it wants to send some information message to its cluster

head. The corresponding cluster head after getting the information message do not decrypt

it but just deliver it to the base station. The base station decrypts the message by using its private key of the corresponding cluster head

and gets the original message. In this way a secure communication between the base station

and the cluster node is preserved. The communication model between the cluster node and the base station is depicted in Figure 2.

Page 4: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

132 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

b) Encryption In our scenario the cluster which wants to send

the information message encrypts it and sends it to the base station through the cluster head by using RSA algorithm. Energy and memory

constrains are the vital part for the cluster node. We change the packet format of the

message by adding an extra field called the identification field. The packet formats of the original, modified and encrypted

are shown in Figure 3, Figure 4, and Figure 5 respectively

SOURCE Original msg

…… DESTINATION

Figure 3: Original Message Packet Format

Figure 4: Modified Message Packet Format

Figure 5: Encrypted Message Packet Format The basic RSA algorithm is modified to make it

applicable for sensor node. When sensor nodes want to send some information messages it

changes the original ASCII(American Standard Code for Information Interchange) value to a range between 1 and 3 comparing the ASCII

value of the letter of the message and for this reason we have to add a field called the

identification field (msg->iden) in the data packet. Let us consider that a message (msg) ‘Abandon’ is to be sent by the cluster node to its

cluster head. Let msg->Val=ASCII value of a letter of a message, msg. The cluster node

compares the ASCII value of the letter ‘A’ and in the identification field it writes 1 and then the modified value becomes 1 as well. So, the large

original value is changed to a modified value

between ranges of 1 to 3. And to identify each symbol or character an additional field is

added called identification field. In the example code we have shown this (64< msg->Val <67 THEN msg->Val=msg->Val-64 AND msg-

>iden=1). Similarly, ‘a’ will also have the same modified value as ‘A’ but the identification field

is different. If ‘b’ has to be sent, same identification value will be used as ‘a’. But the modified value of ‘b’ to be encrypted will be

different, which is 2. Then the cluster node encrypted the modified value and the identification field with the public key of the

cluster head of the cluster. The cluster node stores the encrypted value of the modified value

when the public key is not changing for the cluster. When the cluster node finds the same modified value has to be encrypted using the

same public key, it will send the previous encrypted value and thus save the cost of

encryption computation. But if the public key has changed then it has to find the encrypted value for the modified value and the

identification field value also

c) Decryption

In the base station, decryption method of RSA is applied. The base station decrypts the encrypted

modified value of the message and the encrypted identification field. Then base station

finds the modified value and the identification field as sent by the cluster node. The base station gets the original ASCII value of the

symbol or character, sent by the cluster node by checking the identification field value. (IF msg-

>iden==1 THEN msg->val =msg->val+64). In this way the base station gets the original message sent by the cluster node. As the

frequency of public key broadcasting by the cluster head is much less than the frequency of

sending information message by the cluster node, very less encryption process is applied for the cluster node. In the data packet we also add

a field to preserve the integrity of it. The sender node adds all the modified value of the symbols

or characters and encrypts the added value with the public key of the cluster head. When the

SOURCE ID Field

Modified msg

…… DESTINATION

SOURCE

Encrypted

Field

Encrypted

Modified msg

……

DESTINATION

Page 5: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

133 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

base station gets the message, adds the modified values of the different characters or symbols and

encrypts it with the public key of the cluster head. If the encrypted value is same as the value sent by the cluster node then integrity preserved

otherwise the message is tempered.

PROPOSED ALGORITHM. OF RSA

The algorithm given below is used for both the

encryption and Decryption process of a message. In this algorithm we use the mathematical equation (p*q) mod n= ((p mod

n)*(q mod n)) mod n. We try to represent pe mod n = ((pk mod n) * (pe-k mod n)) mod n,

where pk is just greater than n. In this way we can compute the pe mod n using only integer variable. The algorithm for the implementation

of the proposed security protocol is presented.

Step1. i=0 and p=5 and k= (Pt) 5 mod n // Pt is the modified value of the msg letters Step2. A[i] = k, B[i] =p and k= (k*k) mod n

Step3. p=p*2 and i=i+1 Step4. Repeat Steps 2 to 3 For key>p

Step5. l=1, p=p/2 and i=i-1 Step6. l= {l*A[i]} mod n and key=key-p Step7. IF (key>B[i]) THEN key=key - B[i] and

l= (l*A[i]) mod n Step8. Else i--

Step9. Repeat Steps 7 to 8 IF Key >5 Step10. IF (key<=5) THEN compute b <-(Pt)k mod n

Step11. Else b=1 Step12. Ct<-(l*b) mod n; // Ct is the Cipher text

B) ECC

In the literature, many authors have tried to

exploit the features of EC field to deploy for security applications. We have outlined some of the highlights of the relevant work in this

section .M.Aydos et.al [6] has presented an implementation of ECC over the field GF(p)

on an 80 MHz, 32 bit RAM microprocessor along with the results. Kristin Lauter has provided an overview of ECC for wireless

security [7]. It focuses on the performance

advantages in the wireless environment by using ECC instead of the traditional RSA

cryptosystem. Ray C., [8] in his work has explained the design of a generator, which automatically produces a customized ECC

hardware that meets user-defined requirements. Alessandro Cilardo et al explains the

engineering of ECC as a complex interdisciplinary research field encompassing such fields as mathematics, computer science

and electrical engineering[9]. C. J. McIvor et.al [10] introduces a novel hardware architecture for ECC over GF(p). The work presented by

Gang Chen presents a high performance EC cryptographic process for general curves over

GF(p) [11]. The standard specifications for public key cryptography is defined in[12] . A simple

tutorial of ECC concept is very well documented and illustrated in the text authored

by Williams Stallings et.al [13]. The paper presented by Kevin M. Finnigin et al outlines a brute-force attack on ECC implemented on UC

Berkley's Tiny OS operating system for wireless sensor networks [14]. The attack exploits the

short period of the pseudorandom number generators used by cryptosystem to generate private keys. An efficient and novel approach of

a scalar point multiplication method than existing double and add by applying redundant

recoding, which originates from radix-4 Booths algorithm was proposed by Sangook Moon[15]. In the paper as proposed by Jaewon Lee [16]

presents 3 algorithms to perform scalar multiplication on EC defined over higher

characteristic finite fields such as OEA (Optimal Extension Field). Liu Yongliang [17] showed that Aydos et al.' s protocol is vulnerable to

man-in the-middle attack from any attacker but not restricted on the inside attacker. They

proposed a novel ECC based wireless authentication protocol. A comprehensive coverage of EC field with the in-depth

mathematical treatment is given in [18]. Owing to these existing works on ECC and its

popularity, it is proposed to implement the crypto system based on ECC for text based

Page 6: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

134 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

application. The proposed work can be extended to XML based application since the future

middleware technologies are in the control of XML based documents which is purely based on text.

PROPOSED METHOD DESCRIPTION OF

ECC

A general elliptic curve takes the general form as

E : y2 = x3+ ax + b (1) where x, yare elements of GF(p), and a, b are integer modulo

p, satisfying 4a3+27b2 # 0 ( mod p )

(2) Here 'p' is known as modular prime integer making the EC finite field. An elliptic curve E

over GF(p) consist of the solutions(x, y) defined by (1) and (2), along with an additional element

called 0, which is the point of EC at infinity. The set of points (x, y) are said to be affine coordinate point representation

The basic EC operations are point addition and

point doubling. Elliptic curve cryptographic primitives [12] require scalar point multiplication. Say, given a point P(x, y) on an

EC, one needs to compute kP, where k is a positive integer. This is achieved by a series of

doubling and addition of P. Say, given k =13, entails the following sequence of operations, by which the efficiency of the scalar multiplication

of the points is improved.

P 2P 3P 6P 12P 13P

Doubling

Addition

Doubling

Doublin

g

Addition

Let us start with P(Xp, Yp). To determine 2P, P is doubled. This should be an affine point on

EC. Use the following equation, which is a tangent to the curve at point P.

S = [(3Xp2 + a)/2yp] mod p

(3)

Then 2P has affine coordinates (XR, YR) given by:

XR = (S2- 2 Xp) mod p YR = [S (Xp – XR) – YP] mod p

(4) Now to determine 3P, we use addition of points

P and 2P, treating 2P=Q. Here P has coordinates (XP, YP), Q=2P has coordinates (XQ, YQ). Now the slope is:

S = [(YQ- YP) I (XQ – XP)] mod p P+Q=-R XR = (S2 – XP- XR) mod p

YR = (S (XP – XR) –YP] mod p (5)

Therefore we apply doubling and addition depending on a sequence of operations determined for 'k'. Every point (XR, YR)

evaluated by doubling or addition is an affine point (points on the Elliptic Curve).

PROPOSED ALGORITHM OF ECC

To do operations with EC points in order to encrypt and decrypt the points are to be

generated first. The algorithm 'genPoints' describes the process of generating the points for the given parameters 'a', 'b', and 'p'. Also the

algorithm 'ECC' describes the process of encryption and decryption on EC field.

Algorithm genPoints (a, b, p)

{

X=O; While(x <p)

Y2=(x3 + ax + b) mod p; if (y2 is a perfect square in GF(p)) output(x, sqrt(y)) (x, -sqrt(y));

x= x+I; }

Algorithm ECC

{

// Key Distribution

// Let U A and UB be legitimate users

UA= { PA, nA } // Key pair for UA UB= { PB, nB } // Key pair for UB

Page 7: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

135 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

// Send the Public key of UB to UA

Send ( PB,UA );

// Send the Public key of UA to UB

Send (PA, UB);

// Encryption at A

Pm l = a Pm

// a: Ascii value of text // Pm : random point on EC PB = nB * G

// G is the base point of EC // nB is the private key Cipher Text={ kG, Pm l + k * PB}

// Decryption at B Let kG be the first point and Pml + k*PB second point

nB kG = nB * first point; Calculate Pml = Pml + k PB - nBkG;

Calculate the Pm value from Pml

using discrete logarithm

}

IMPLEMENTATION OF THE PROPOSED

ALGORITHM OF ECC

The typical Elliptic Curve is represented by:

Y2 mod 163 = x3+x+l mod 163 Points on the curve can be found as shown in

Table 1.1

The base point G is selected as (0, 1). Base point implies that it has the smallest (x, y) co-ordinates which satisfy the EC. Pmis another

affine point, which is picked out of a series of affine points evaluated for the given EC. We

could have retained G itself for Pm. However for the purpose of individual identity, we choose f1n to be different from G. Let Pml = (5,72). The

choice of pm is itself an exercise involving meticulous application of the ECC process on

the given EC.

The ECC method requires that we select a random integer k (k<p), which needs to be kept

secret. Then kG is evaluated, by a series of additions and doublings, as discussed above. For purpose of this discussion we shall call the

source as host A, and the destination as host B. We select the private key of the host B, called

nB, k and nB can be generated by random number generators to give credibility. For simplicity we shall assume that k = 19, and nB =

72. The public key of B is evaluated by PB=nB G ( 6)

Suppose A wants to encrypt and transmit a

character to B, he does the following. Assume that host A wants to transmit the character ' [ ' . Then the ASCII value of the character ' [ ' is 91.

Therefore,

PB= nB G = 19(0,1) = (4,118) Pml= 91(5,72) = (7,5)

The coordinates of the Pm! should fit into the EC. This transformation is done for two

purposes. First the single valued ASCII is transformed into a (x, y) co-ordinate of the EC. Second it is completely camouflaged from the

would-be hacker. This is actually intended to introduce some level of complexity even before

the message is encrypted according to ECC.As the next step of ECC, we need to evaluate k PB, here PB is a public key of user B. Determining

this product involves a series of doubling and additions, depending on the value of k. For a

quick convergence of the result, we should plan for optimal number of doublings and additions K PB= 19(4,118) = (4,118)

Pml+k PB= (7,5) + (4,118)= (20,69) kG = 19(0,1) = (0,1)

The encrypted message is derived by adding Pml with k PB that is, Pml+k PB. This yields a set of (x2, y2) coordinates. Then kG is included as the

first element (xl, yl) of the encrypted version. Hence the entire encrypted version for purposes

of storing or transmission consists of two sets of coordinates as follows:

Page 8: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

136 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

(0,1) ( 0,162) (4,45) (4,118) (5,72) (5,91)

(6, 68 ) (6, 95 ) (7, 5 ) ( 7,158) ( 9,24 ) (9,139 )

( 10,14) (10,149) (11,56 ) (11,107) (12,33 ) (12,130)

( 14,71) (14,92 ) (15,72 ) ( 15,91 ) (16,53 ) (16,110)

(17,81 ) (17,82 ) (18,31 ) (18,132) ( 19,14) (19,149)

(20, 69) ( 20, 94) (21, 36) (21,127) (27, 71) ( 27, 92)

(29, 28) (29,135) (30, 25) (30,138) ( 32,53) (32,110)

(33, 33) (33,130) (34, 43) (34,120) (37, 18) (37,145)

(38,44 ) (38,119) (40,54 ) (40,109) (41,60 ) (41,103)

(44, 44) (44,119) (45,39 ) (45,124) (47, 23) (47,140)

(51, 64) (51, 99 ) (52, 36) (52,127) (54, 77) (54, 86 )

(57, 75) (57, 88 ) (58, 68) (58, 95 ) (62, 30) (62,133)

(63, 45) (63,118) (65, 6 ) (65,157) (67, 52) (67,111)

(68, 20) (68,143) (69, 42) (69,121) ( 70,49) (70,114)

(71, 19) (71,144) (72, 41) (72,122) (73, 70) (73, 93 )

(74, 9 ) (74,154) ( 81,44) (81,119) (82, 48) (82,115)

(84, 11) (84,152) (87, 76) (87, 87 ) 88, 59) (88,104)

(89, 35) (89,128) (90, 36) (90,127) (93, 32) (93,131)

(95, 55) (95,108) (96,45 ) (96,118) (97,42 ) (97,121)

(99,68) (99, 95 ) (100,52) (100,111) (107,80) (107,83)

(109,58) (109,105) (110,78) (110, 85) (111,70) (111,93)

Page 9: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

137 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

(112,12) (112,151) (113,61) (113, 102 (114,57) (114,106)

(115,53) (115,110) (117,16) (117,147) (118,33) (118,130)

(119,48) (119,115) (120,22) (120,141) (121, 6) (121,157)

(122,71) (122, 92 ) (125,48) (125,115) (126, 2) (126, 161

(127,47) (127,116) (130,39) (130,124) (134,14) (134,149)

(135, 29 (135,134) (136,60) (136,103) (140, 6 ) (140,157)

(142,70) (142, 93 ) (143,72) (143, 91) (144,28) (144,135)

(148,69) ( 148,94) (149,60) (149,103) (151,39) (151,124)

(152,17) (152,146) (153,28) (153,135) (155,40) (155,123)

(156,38) (156,125) (158,69) (158, 94) (159,52) (159,111)

(160,42) (160,121) .

Table 1.1: Set of sample points on EC

Cm = (kG, Pml+k PB)

kG=xl,yl Pml+k PB = x2, y2 Encrypted version of the message is: ( (0, 1),

(20,69), where xl = 0, yl = 1, x2 = 20, y2 = 69. Thus far the

modified plaintext has been encrypted by application of the ECC method. The modification of the plaintext in conjunction with

Pml is a novel idea of this paper. Recall that kG is represented by (x1, y 1) and Pm l+ k PB is

represented by (x2, y2). In order to pull out f1nl from Pml+k PB, B

applies his secret key nB and multiplies kG so that, nB KG= k PB. Subtract this from Pml+k PB,

to get Pml that is, Pml= Pml+ k PB – nB kG. nB kG =19(0,1) = (4,118) Pml =(20,69 )-(4,118)= (7,5):

This subtraction is another ECC procedure involving doubling and addition. But the only

difference is that the negative term will have its y co-ordinate preceded by a minus sign. With

this subtle change in mind, the expression of

determining the slope, new values of xR, yR are the same.Wherever y figures, it is substituted as

-y. This will yield Pml

Now apply discrete logarithm concept to get the

ASCII value of"[". [(5,72) = (7,5) Therefore, [ = 91.Thus we retrieve the character "[".

III. SIMULATION AND RESULTS

We simulate wireless sensor network with deployment of 24 nodes in the network in which 0th node acts as base station remaining nodes are

made to form as clusters and in each group of cluster we select one cluster head based on its

highest energy,this cluster head interacts and transfers information to the base station , further simulations are as follows. The following Table

2.1 shows the configuration of parameters

Page 10: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

138 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

Channel type Wireless channel

Mac type Mac/802_11

No of nodes 24

Routing protocol DSR

X axis distance 1500

Y axis distance 1500

Initial energy of node 100joules

Table2.1: configuration of parameters

1)RSA SNAPSHOTS

Figure 6 : Terminal

Figure 6 shows the terminal execution of RSA

algorithm. Here we all the individual ,separate

awk , tcl files etc .in order to integrate all the

modules ,we are going for shell scripting after

saving all the files or commands using .sh

extension(./run.sh),once we run this all the

background files will execute here we have

entered two prime numbers and the input

message as computer

Figure 7: Node deployment

The Figure 7 shows nodes deployment in the

network which has been displayed on a Nam(network animator) window. Here several

nodes are deployed in the network in a zig zag form in these nodes 0th node acts a base station

After knowing the position and distance of neighbor nodes. We send route request ,once the

route reply gets back to back station, based on routing information we pass the packets.

Whenever we transmit packets to the neighbor nodes, we need to get reply from neighbor nodes, it leads to an reliable data transfer(udp),so

ACK(acknowledgement) receives from all nodes to the base station

. Figure 8: Cluster formation

Figure 8 shows cluster formation of nodes ,here clustering is done in which nodes in the network are made to form as groups.(cluster).thus we can

balance the energy level of the network by doing clustering, by doing this we can avoid

miscellaneous nodes and using clusters we can also transmit the data very fast

Figure 9 : Voting mechanism

Figure 10: Cluster head selection

Page 11: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

139 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

Figure 9 shows leader election or voting mechanism in which the compiler will generate

energy levels of each node, using trace file we will record the information happening in the network, without calculating energy and cost

values of nodes we cant do leader election algorithm ,based on these parameters we choose

leader nodes or cluster heads which is depicted in figure 10(cluster head selection) here the cluster heads collect information from group of

neighbor nodes and then send the required data to the base station

Figure 11 : Encryption process

Figure 12: Decryption process

Figure 11and 12 shows encryption and

decryption process of RSA algorithm. The process of converting a plaintext msg into a cipher text msg is known as encryption. when

encryption method of RSA is applied ,the cluster encrypts the msg using public key into a cipher

text which has to be sent to base station through cluster head by using RSA algorithm In the base station, decryption method of RSA is

applied .the base station decrypts the encrypted msg by using private key in order to get the

original format of the msg. the simulations are as shown in the figures 11 and 12 respectively

2) ECC SNAPSHOTS

Figure 13: Terminal execution of ECC

algorithm

Figure 14: Encryption and decryption process of

ECC

Figure 13 shows the snapshot of terminal during

running the program .In the terminal once if we enter the msg, it will point on the curve, some point like (1,3)etc, so then public and private

keys will generate. here with many combinations,the data will be generated as keys

as shown in table 1.1 Now the keys will travel in the network,the keys will exchange internally, keys are not constant

thus we or hackers cant find which keys are travelling in the network, but the base station

knows about the original data by using internal keys,all the keys will be loaded in key generation file once the encryption process

begins the message which we give as input will be in a key format.now decryption method of

ECC algorithm will be applied in order to decrypt the original msg these simulations are shown in figure 14

Page 12: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

140 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

3)RSA and ECC comparison results

Figure 15 : Energy consumption

Figure 15 shows the x graph for energy consumption of both RSA and ECC. Once we deploy the nodes in network it goes to kernel

control. Then we will extract energy from trace file and we display in the graph. Here ECC will

take less energy consumption for data transmission but RSA will suddenly consumes so much of energy. The main consumption due

to encryption and decryption process will take more delay. Therefore energy drops will be

more in RSA when compared to ECC

Figure 16: Packet delivery ratio(pdr)

The Figure 16 shows packet delivery ratio(pdr) of both RSA and ECC The pdr is defined as the

no of packets receiving/received packets plus(+)no of loss packets. In case of RSA, there

is no much delivery ratio because delay is more such that user may not receive the data in time In case of ECC, pdr will be more because it will

take less delay for converting text messages into keys or key pairs As we notice in Figure 16

RSA after long time it is responding For the packets when compared to ECC. ECC will respond soon for the packets than RSA

Figure 17: Throughput

The above Figure 17 shows the throughput of RSA and ECC. It is defined as how much data

can be transferred from one location to another in a given amount of time .it is measured in bits per second or data packets per time slot. In RSA

initially It will perform well later it will take long time for responding as well as to reach the

dead line .where as ECC will responds in a less time for the throughput.

Figure 18: Packet drops

The Figure 18 shows the packet drops of RSA

and ECC .as we can see that both are in 0-axis,that is no loses ,it will not effect on the packets, RSA is the best in case of packet drops,

on same time ECC will not show the effect.

V. CONCLUSION

In this paper we have designed and implemented

RSA and ECC for establishing secure connection in wireless sensor network. Here we

can conclude that ECC provides better performance for the parameters( energy ,packet delivery ratio ,throughput, packet drops)The

three most widely adopted cryptosystems are RSA, DSA and ECC, in which ECC is

Page 13: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

141 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

considered as the one which has the highest security quality in per bit key among current

public key cryptosystems and also computationally more efficient than RSA

At lower key bit size ECC provide same level of security as RSA. That is ECC is an excellent

choice for asymmetric cryptography in portable constrained devices. 1024-bit RSA key provides the same level of security as a160-bit elliptic

curve key The attractiveness of ECC, when compared to

RSA, is that it appears to offer better security for a smaller key size, there by reducing

processing overhead. The use of shorter keys means lower space requirements for key storage and quicker arithmetic operations, lower power

consumption, bandwidth savings, storage efficiencies, and smaller certificates. These

advantages are particularly beneficial in applications where bandwidths, processing capacity, power availability or storage are

constrained. Such applications include chip cards, electronic commerce, web servers and

cellular telephones .it can be concluded that ECC is the most optimal and efficient algorithm for wireless communication

REFERENCES

[1] John Paul Walters, Zhengqiang Liang, WeisongShi, and Vipin Chaudhary, “Wireless Sensor Network Security: A Survey”, Security

in Distributed, Grid and Pervasive Computing 17:367-388, 2007.

[2] I.F. Akyildiz, W. Su, Y. Sankarasubramaniam, E. Cayirci, Wireless

sensor networks: A survey, Computer Networks 38 (4) (2002) 393–422.

[3] Xin Zhou, Xiaofei Tang, “Research and Implementation of RSA Algorithm for

Encryption and Decryption”, IEEE, 6th International Forum on Strategic Technology,

pp- 1118 – 1121

[4] R.L. Rivest, A. Shamir, L.M. Adleman, A

method for obtaining digital signatures and public-key cryptosystems’’, Communications of the ACM 21 (2) (1978) 120–126

[5] N.Koblitz, Elliptic Curve Cryptosystems,

Mathematics of Computation, volA8, 1987, pp.203 -209

[6] M.Aydos, T.Yanik and C.K.Kog, "High-speed implementation of an ECC based wireless authentication protocol on an ARM

microprocessor," lEE Proc Commun.,Vol. 148, No.5, pp. 273-279, October 2001.

[7] Kristin Lauter, "The Advantages of Elliptic Cryptography for Wireless Security", IEEE

Wireless Communications, pp. 62- 67, Feb. 2006

. [8] Ray C. C. Cheng, Nicolas Jean-baptiste, Wayne Luk, and 7eter Y. K

Cheung,"Customizable Elliptic Curve Cryptosystems" , IEEE Trans. On VLSI Systems,

vol. 13, no. 9, pp. 1048-1059, Sep. 2005. [9] Alessandro Cilardo, Luigi Coppolino, Nicola

Mazzocca, and Luigi Romano,"Elliptic Curve Cryptography Engineering", Proceedings of the

IEEE, Vol. 94, no. 2, pp. 395 - 406, Feb. 2006. [10] C. 1. McIvor, M. McLoone, and 1. V.

McCanny, "Hardware elliptic curve cryptographic processor over GF(p)," IEEE

Trans. Circuits Syst.l Reg. Papers, vol. 53, no. 9, pp. 1946-1957, Sep. 2006 .

[11] Gang Chen, Guoqiang Bai, and Hongyi Chen, " A High-Performance Elliptic Curve

Cryptographic Processor for General Curves Over GF(p) Based on a Systolic Arithmetic Unit" , IEEE Trans. Circuits Syst. - 11: Express

Briefs, vol. 54, no. 5, pp. 412- 416, May. 2007.

[12] Standard specifications for public key cryptography, IEEE standard, pI363,2000.

Page 14: IMPLEMENTATION OF RSA AND ECC SECURITY PROTOCOLS …academicscience.co.in/admin/resources/project/paper/f... · network (WSN) is increasing in a rapid speed. ... protocols in NS2.35

142 Manjunath K, Dr.Nalini N

International Journal of Innovations & Advancement in Computer Science

IJIACS

ISSN 2347 – 8616

Volume 3, Issue 4

June 2014

[13] Williams Stallings, Cryptography and

Network Security, Prentice Hall, 4th Edition, 2006.

[14] Kevin M. Finnigin, Barry E. Mullins, Richard A. Raines, Henry B.Potoczny,

"Cryptanalysis of an elliptic curve cryptosystem for wireless sensor networks," Internationaljournal ofsecurity and networks,

Vol. 2, No. 3/4, pp. 260- 271,2006. [15] Sangook Moon, "A Binary Redundant

Scalar Point Multiplication In Secure Elliptic Curve Cryptosystems," International journal of

network security, Vol.3, No.2, PP.132-137, Sept. 2006

[16] Jaewon Lee, Heeyoul Kim, Younho Lee, Seong-Min Hong, and Hyunsoo Yoon,

"Parallelized Scalar Multiplication on Elliptic Curves Defined over Optimal Extension Field," International journal of network security, VolA,

No.1, PP.99-106, Jan. 2007.

[17] Liu Yongliang, Wen Gao, Hongxun Yao, and Xinghua Yu , "Elliptic Curve Cryptography

Based Wireless Authentication Protocol," Internationa journal ofnetwork security, VolA, No.1, PP.99-106, Jan. 2007.

[18] R.V.Kurja, Kirti Joshi, N.Mohan Kumar,

Kapil H Raranape, A.Ramanathan, T.N.Shorey, R.R.Simha, and V.Srinivas, Elliptic Curves, International Distribution by American

Mathematical Society, 2006. [19] Asha Rani Mishra, Mahesh Singh "Elliptic

Curve Cryptography (ECC) for Security in wireless Sensor Network"Vol. 1 Issue 3, May -

2012