Top Banner
Linear Feedback Shift Register (LFSR) for Secure Message Transfer A mini project report submitted in partial fulfillment for the award of the degree of B.Tech In INFORMATION TECHNOLOGY By, Nikin Kumar Jain (06BIT113) Under the Guidance of, Mrs. P. Jayalakshmi Asst. Professor School of Information Technology and Engineering VIT University SCHOOL OF INFORMATION TECHNOLOGY AND ENGINEERING MAY 2010
38
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Final Documentation

Linear Feedback Shift Register

(LFSR) for

Secure Message Transfer

A mini project report submitted in partial fulfillment for the award of the degree of

B.Tech

In

INFORMATION TECHNOLOGY

By,

Nikin Kumar Jain (06BIT113)

Under the Guidance of,

Mrs. P. Jayalakshmi

Asst. Professor

School of Information Technology and Engineering

VIT University

SCHOOL OF INFORMATION TECHNOLOGY AND ENGINEERING

MAY 2010

Page 2: Final Documentation

Vellore - 632 014, TN, India

School of Information Technology and Engineering

DECLARATION

I hereby declare that the main project report entitled “Linear Feedback Shift Register

(LFSR) for Secure Message Transfer” submitted by me to the School of Information

Technology and Engineering, VIT University, Vellore-14 as per the curriculum requirement

for VIII Semester of B.Tech Information Technology is a record of bonafide project work

carried out by me under the guidance of Mrs. P. Jayalakshmi, Asst. Professor, SITE. I

further declare that the work reported in this project has not been submitted and will not

be submitted, either in part or in full, for the award of any other degree or diploma of this

institute or of any other institute or university.

Place: Vellore

Date:

Signature of candidate

Nikin Kumar Jain

Page 3: Final Documentation

SCHOOL OF INFORMATION TECHNOLOGY AND ENGINEERING

BONAFIDE CERTIFICATE

This is to certify that the project report entitled “Linear Feed Back Shift Register

(LFSR) for Secure Message Transfer” submitted by Nikin Kumar Jain (06BIT113) to VIT

University, Vellore as per the curriculum requirement for VIII Semester of B.Tech

Information Technology is a record of bonafide work carried out by him under my

guidance. The project fulfills the requirement as per the regulations of this institute and in

my opinion meets the necessary standards of submission. The contents of this report have

not been submitted and will not be submitted either in part or in full for the award of any

other degree or diploma in this institute or any other institute or university.

Place: Vellore

Date:

______________Signature_______________________

(Mrs. P. JayaLakshmi)

Asst. Professor

School of Information Technology and Engineering

Internal Examiner External Examiner

Date: Date:

Page 4: Final Documentation
Page 5: Final Documentation

I

ACKNOWLEDGEMENT

I dedicate this page to all those who have silently or actively left an indelible mark on my

project report, so that they may get all credit which they richly deserve.

Talent and capability is of course necessary but opportunities and right guidance is two very

important prerequisites without which any person cannot climb the ladder of success. Proper

guidance and direction are required in order to achieve the goal and making optimum of each and

every opportunity.

Mundane words are not enough to express my insufficient indebtedness towards Honorable

Chancellor Dr. G. Viswanathan, Dr. Bandaru Rama Krishna Rao, Director, SITE, VIT

University and Mr. S. Balaraman, Program Manager, SITE, VIT University whose enormous

assistance has helped me in the completion of the project.

I am thankful from the core of my heart and express my feeling of gratitude to my Year

Coordinator Mr. P. J. Kumar Asst. Professor and Project Guide Mrs. Jayalakshmi P., Asst.

Professor, School of Information Technology and Engineering, VIT University whose constant

support and faith in me has always motivated. Their knowledge and brilliance have pulled me

out of doldrums many a time in this project.

Page 6: Final Documentation

II

ABSTRACT

Most communication channels like telephone lines and radio broadcasts transmit signals

which are many-a times tapped by an undesirable source. This breach of security can be

surmounted by a secret signal that has been transformed into a form that is difficult to be

decrypted from sources without knowledge of a secret key and this way, the secret signal can be

transmitted undetected. Internet users frequently need to store, send or retrieve private

information. The most common way to do this is to transform the plain data into a non-

understandable form called “Encrypted Data”. Only those who know how to decrypt it can

understand the encrypted data. This method of protecting data is known as encryption.

The purpose of this document is to describe the steps taken in the development of encryption

tool using LFSR technique. This document describes the development phases as well as the

working of the tool. This comprehensive tool thus developed finds extensive use in transferring

crucial data over various channels safely. The two level security offered by the tool enhances

increases its reliability thus enhancing its usability.

Page 7: Final Documentation

III

Table of Contents

Chapter No. Contents Page

Acknowledgment IAbstract IITable of Contents IIIList of Figures VList of Tables VI

1. Introduction 11.1 Definition 11.2 Motivation 11.3 Aim & Objective 21.4 Purpose & Scope 21.5 Brief History 22 Requirements 32.1 Requirements 32.1.1 System Requirements 32.2 Product Perspective 32.3 Product Function 32.4 Functional Requirements 43 Architecture Specifications 53.1 LFSR Implementation Strategy 63.2 LFSR Implementation Review 73.3 Description of LFSR 83.3.1 Shift Register 83.3.2 Some Nomenclature in LFSR 93.3.3 Feedback Function 103.3.4 Tap Sequences 114 Methodology 124.1 Implementation of LFSR Encryption 124.2 Implementation of LFSR Decryption 135 Design 145.1 Cryptographic Techniques 145.2 LFSR Tool 145.3 Applications of LFSR 145.4 Logical Implementation of LFSR 155.5 Uses in Cryptography 165.6 LFSR Based Stream-Ciphers-HLD 166 Implementation Modules 186.1 Client Site Code 186.2 Server Site Code 207 Modules-Output/Results 21

Page 8: Final Documentation

IV

Chapter No. Contents Page

7.1 File Encryption-Decryption 217.1.1 Applet Encryption Module 217.1.2 Command-Line File Encryption 227.1.3 Server-Side File Receivables 238 Unit Testing and Integration Testing 248.1 Project Scheduling 248.2 PERT Chart 259 Deployment and Acceptance Testing 269.1 Frame-Work Applied 269.2 Requirements 269.3 Product Perspective 269.4 Product function 2610 Conclusion 2711 Future Enhancements 2712 Literature Survey and References 27

Appendix – A 28

Page 9: Final Documentation

V

List of Figures

Figure No. Title of Figure Page No.

3.1.1 Architecture of Project 53.1.2 D Flip-Flop 63.2.1 Analytic Logic 1 73.2.2 Analytic Logic 2 74.1.1 Methodology 125.4.1 LLD (Low Level Design) of LFSR 155.4.2 Architectural Implementation of Project 155.6.1 HLD of Client 165.6.2 HLD of Server 177.1.1 File Sender Applet 217.1.2 File Sender Applet with Send Button 217.1.2.1 File Encryption Command Line Module 227.1.2.2 File Encryption-Data Entry 227.1.3.1 Server File Receivables 238.2.1 Pert Chart 25

Page 10: Final Documentation

VI

List of Tables

Table No. Name of Title Page No.

3.3.1 XOR Function 108.1.1 Table for Estimated Term of Project 24

Page 11: Final Documentation

1

1. INTRODUCTION

Most communication channels like telephone lines and radio broadcasts transmit signals

which are many-a times tapped by an undesirable source. This breach of security can be

surmounted by a secret signal that has been transformed into a form that is difficult to be

decrypted from sources without knowledge of a secret key and this way, the secret signal can be

transmitted undetected. Internet users frequently need to store, send or retrieve private

information. The most common way to do this is to transform the plain data into a non-

understandable form called “Encrypted Data”. Only those who know how to decrypt it can

understand the encrypted data. This method of protecting data is known as encryption.

1.1 Definition

Cryptography: It is a practice of hiding information. Modern Cryptography intersects the

disciplines of mathematics, computer science and engineering. Application of cryptography

includes ATM cards, computer passwords and electronic commerce. Cryptography is the process

of converting ordinary information into cipher text. Decryption is the reverse, in other words,

moving from the unintelligible cipher text back to plain text.

Encryption: Encryption is the process of passing data or plaintext through a series of

mathematical operations that generate an alternate form of the original data known as cipher-text.

The encrypted data can only be read by parties who have been given the necessary key to decrypt

the cipher-text back into its original plaintext form. Encryption doesn't hide data, but it does

make it hard to read!

1.2 Motivation

Literature Survey: The development of digital computers and electronics made possible

much more complex ciphers. Many computer ciphers can be categorized by their operation on

binary bit sequences, unlike classical and mechanical schemes, which generally manipulate

traditional characters directly. Developers need to be very much aware because of continuous

improvement in computer processing power have increased the scope of brute-force attack.

Page 12: Final Documentation

2

1.3 Aim & Objective

Problem Formulation: Alice and Bob are in male/female prisons and want to

communicate to make an escape plan. Warden Wendy would let them communicate but would

monitor the communication. A solution needs to be found out such that the communication

would seem to be unperceivable to person who isn’t aware that “something lies beneath it”.

1.4 Purpose & Scope

LFSR: The purpose of this document is to describe the steps taken in the development of

encryption tool using LFSR technique. This document describes the development phases as well

as the working of the tool. This comprehensive tool thus developed finds extensive use in

transferring crucial data over various channels safely. The two level security offered by the tool

enhances increases its reliability thus enhancing its usability.

1.5 Brief History:

Romans used invisible inks, which were based on natural substances such as fruit juices and

milk. This was accomplished by heating the hidden text, thus revealing its contents. Invisible

inks have become much more advanced and are still in limited use today. In the digital world of

today, namely 1992 to present, Encryption is being used all over the world on computer systems.

Many tools and technologies have been created that take advantage of old encryption techniques

such as null ciphers, coding in images, audio, video and microdot.

Page 13: Final Documentation

3

2. REQUIREMENTS

2.1 Requirements

2.1.1 System Requirements: Since the product is using Java as a supporting language the

product will be portable and can work on operating systems which support JVM (Java Virtual

Machine). The system requires any platform supporting .Bmp, Gif, .Txt formats with minimum

RAM 64 Mb.

I. Design Constraint: The system requires O.S environments Windows 9x, 2000,

NT or XP.

II. Software Requirements: J2SE.

III. Hardware Requirements: Should be capable of supporting basic Networking.

2.2 Product perspective

The system is to be designed for the safest transfer of data across any two computers. The

product provides reliability and hence can be used for transfer of important documents without

being noticed.

2.3 Product function

The product provides the function of Encrypting the Data and then Inserting the encrypted

data in the Image at the source end and extracting the encrypted data and thereafter Decrypting

the message to obtain the data.

Page 14: Final Documentation

4

2.4 Functional Requirements

Implementation of LFSR Encryption

Take the text to be encrypted from the file.

Start using the input text file byte by byte.

According to that a key is generated. Use this key and start using the text in

that input file.

Perform the XOR operation b/w the current byte of the key and the current byte

of the input text. Perform this operation continuously b/w the next elements of

the text and the key.

In case the pointer gets to the final element of the key, move the pointer back to

the initial element of the key and keep on performing the third step.

Continue the above steps till the whole data is encrypted.

Implementation of LFSR Decryption

Use the key to decrypt the encrypted data...

Start using the encrypted text byte by byte.

According to that a key is generated. Use the key and start using the encrypted

text.

Perform the XOR operation b/w the current byte of the key and the current byte

of the encrypted text. Perform this operation continuously b/w the next elements

of the text and the key.

In case the pointer gets to the final element of the key, move the pointer back to

the initial element of the key and keep on performing the third step.

Continue the above steps till the whole data is decrypted.

Page 15: Final Documentation

5

3. ARCHITECTURE SPECIFICATIONS

Fig. 3.1.1: Architecture of Project

Page 16: Final Documentation

6

D1 D2 D3 D4 D5

XOR

3.1 LFSR Implementation Strategy:

Linear Feed Shift Registers (LFSR) is a mechanism of generating a random binary sequence.

The Linear Feedback Shift Register consists of a series of D flip-flops that are initialized by an

initialization vector, also called as seed value. A clock synchronizes the D flip-flops. At every

clock tick, a bit is output and the values in the flip-flops are shifted to the right by one. The first

flip-flop gets its value from a polynomial function involving certain cells.

The polynomial function is responsible for incorporating Non-Linearity in the output binary

sequence. Linear Feed Shift Registers play an extremely vital role in generating keys for various

encryption techniques. Linear Feed Shift Registers generate extremely good pseudo random

sequence. The period of sequence is 2 raise to power n minus 1 (2n –1), where n is the number of

cells in the LFSR.

Fig3.1.2: D Flip-Flop

Consider the output of the last 3 flip-flops of the above figure. At every stage we get a random

decimal number ranging from 0 to 7. The length of this sequence of random numbers is 2n –1,

after which the sequence starts repeating. Higher the values of n, higher are the randomness.

Page 17: Final Documentation

7

In this technique we store the data in the bit that is the decimal values shown by the last 3

flip-flops. So we store the data in the 2nd bit of first byte, then in the 3rd bit of second byte, then

in the LSB of the third byte and so on. Hence the attacker would not be able to know the secret

data until the attacker knows the seed value, which was used to initialize the flip-flops because

with different initialization vector we get different random sequence. The randomness involved

in this encryption technique secures the data to a great extent.

3.2 LFSR Implementation Review

Fig 3.2.1: Analytic Logic 1

Fig3.2.2: Analytic Logic 2

Page 18: Final Documentation

8

3.3 Description of LFSR

A linear feedback shift register (LFSR) mega function is based on linear XOR or XNOR

feedback logic in which the initial value of the shift register, shift register taps, and feedback

logic determines the output sequence. This scheme allows the user to load the shift register with

an initialization sequence. The shift register taps are combined with XOR or XNOR logic and

then fed back into the shift register input.

The shift register size (m) is equal to length + 1, where length is an integer between 1 and 31.

The shift register produces a sequence of 2 m - 1 bit. For example, a shift register size of 32

produces a shift register sequence of 232 - 1 bits and is specified by setting the length input to 31.

The length input is synchronous to the rising edge of the clock. When a clock edge loads the

length input, the mega function will automatically reconfigure the shift register's size.

The load input initializes the contents of the shift register. Whenever load is asserted, the

mega function configures itself to a normal shift register size of 32. The desired initial value will

be loaded through the shift in input using 32 clock cycles. Because the length value is ignored

when load is asserted, length can be asserted any time before load de-asserts. The load input can

be de-asserted after the 32nd rising clock edge. The next rising edge of the clock would then

configure the shift register size and feedback logic and initialize the length sequence.

3.3.1 Shift Register

One of the two main parts of an LFSR is the shift register (the other being the feedback

function). A shift register is a device whose identifying function is to shift its contents into

adjacent positions within the register or, in the case of the position on the end, out of the register.

The position on the other end is left empty unless some new content is shifted into the register.

The contents of a shift register are usually thought of as being binary, that is, ones and zeroes.

If a shift register contains the bit pattern 1101, a shift (to the right in this case) would result in the

contents being 0110; another shift yields 0011. After two more shifts, things tend to get boring

since the shift register will never contain anything other than zeroes.

Page 19: Final Documentation

9

Two uses for a shift register are 1) Convert between parallel and serial data and 2) Delay a

serial bit stream. The conversion function can go either way -- fill the shift register positions all

at once (parallel) and then shift them out (serial) or shift the contents into the register bit by bit

(serial) and then read the contents after the register is full (parallel). The delay function simply

shifts the bits from one end of the shift register to the other, providing a delay equal to the length

of the shift register.

3.3.2 Some Nomenclature in LFSR

Clocking: One of the inputs to a shift register is the clock; a shift occurs in the register when

this clock input changes state from one to zero (or from zero to one, depending on the

implementation). From this, the term "clocking" has arisen to mean activating a shift of the

register. Sometimes the register is said to be "strobe" to cause the shift.

Shift direction: A shift register can shift its contents in either direction depending on how the

device is designed. (Some registers have extra inputs that dictate the direction of the shift.) For

the purposes of this discussion, the shift direction will always be from left to right.

Output: During a shift, the bit on the far right end of the shift register is moved out of the

register. This end bit position is often referred to as the output bit. To confuse matters a bit, the

bits that are shifted out of the register are also often referred to as output bits. To really muddy

the waters, every bit in the shift register is considered to be output during a serial to parallel

conversion. Happily, the context in which the term "output" is used generally clears things up.

Input: After a shift, the bit on the left end of the shift register is left empty unless a new bit (one

not contained in the original contents) is put into it. This bit is sometimes referred to as the input

bit. As with the output bit, there are several different references to input that are clarified by

context.

Page 20: Final Documentation

10

3.3.3 Feedback Function

In an LFSR, the bits contained in selected positions in the shift register are combined in some

sort of function and the result is fed back into the register's input bit. By definition, the selected

bit values are collected before the register is clocked and the result of the feedback function is

inserted into the shift register during the shift, filling the position that is emptied as a result of the

shift.

The feedback function in an LFSR has several names: XOR, odd parity, sum modulo 2.

Whatever the name, the function is simple: 1) Add the selected bit values, 2) If the sum is odd,

the output of the function is one; otherwise the output is zero. Table 1 shows the output for a 3

input XOR function.

Table 3.3.1) XOR Function

Input A Input B Input C XOR Output

0 0 0 0

0 0 1 1

0 1 0 1

0 1 1 0

1 0 0 1

1 0 1 0

1 1 0 0

1 1 1 1

Page 21: Final Documentation

11

The bit positions selected for use in the feedback function are called "taps". The list of the

taps is known as the "tap sequence". By convention, the output bit of an LFSR that is n bits long

is the nth bit; the input bit of an LFSR is bit 1.

3.3.4 Tap Sequences

An LFSR is one of a class of devices known as state machines. The contents of the register,

the bits tapped for the feedback function, and the output of the feedback function together

describe the state of the LFSR. With each shift, the LFSR moves to a new state. (There is one

exception to this -- when the contents of the register are all zeroes, the LFSR will never change

state.) For any given state, there can be only one succeeding state. The reverse is also true: any

given state can have only one preceding state.

A state space of an LFSR is the list of all the states the LFSR can be in for a particular tap

sequence and a particular starting value. Any tap sequence will yield at least two state spaces for

an LFSR. (One of these spaces will be the one that contains only one state -- the all zero one.)

Tap sequences that yield only two state spaces are referred to as maximal length tap sequences.

The state of an LFSR that is n bits long can be any one of 2^n different values. The largest

state space possible for such an LFSR will be 2^n - 1 (all possible values minus the zero state).

Because each state can have only once succeeding state, an LFSR with a maximal length tap

sequence will pass through every non-zero state once and only once before repeating a state.

One corollary to this behavior is the output bit stream. The period of an LFSR is defined as

the length of the stream before it repeats. The period, like the state space, is tied to the tap

sequence and the starting value. As a matter of fact, the period is equal to the size of the state

space. The longest period possible corresponds to the largest possible state space, which is

produced by a maximal length tap sequence. (Hence "maximal length")

Page 22: Final Documentation

12

4. METHODOLOGY

4.1 Implementation of LFSR Encryption

Take the text to be encrypted from the file.

Start using the input text file byte by byte.

According to that a key is generated. Use this key and start using the text in that input file.

Perform the XOR operation b/w the current byte of the key and the current byte of the input

text. Perform this operation continuously b/w the next elements of the text and the key.

In case the pointer gets to the final element of the key, move the pointer back to the initial

element of the key and keep on performing the third step.

Continue the above steps till the whole data is encrypted.

Fig 4.1.1 Methodology

Page 23: Final Documentation

13

4.2 Implementation of LFSR Decryption

Use the key to decrypt the encrypted data.

Start using the encrypted text byte by byte.

According to that a key is generated. Use the key and start using the encrypted text.

Perform the XOR operation b/w the current byte of the key and the current byte of the

encrypted text. Perform this operation continuously b/w the next elements of the text and the

key.

In case the pointer gets to the final element of the key, move the pointer back to the initial

element of the key and keep on performing the third step.

Continue the above steps till the whole data is decrypted.

Page 24: Final Documentation

14

5. DESIGN

5.1 Cryptographic Techniques

1. Symmetric-key cryptography: It refers to encryption methods in which both the sender

and receiver share the same key. The modern study of symmetric-key ciphers relates mainly to

the study of block ciphers and stream ciphers and to their applications.

2. Public-key cryptography: The public key may be freely distributed, while its paired

private key must remain secret. The public key is typically used for encryption, while the private

or secret key is used for decryption.

5.2 LFSR Tool

Linear Feed-Back Shift Register: Linear Feed Shift Registers (LFSR) is a mechanism of

generating a random binary sequence. The Linear Feedback Shift Register consists of a series of

D flip-flops that are initialized by an initialization vector, also called as seed value. A clock

synchronizes the D flip-flops. At every clock tick, a bit is output and the values in the flip-flops

are shifted to the right by one. The first flip-flop gets its value from a polynomial function

involving certain cells. The polynomial function is responsible for incorporating Non-Linearity

in the output binary sequence.

Linear Feed Shift Registers play an extremely vital role in generating keys for various

encryption techniques. Linear Feed Shift Registers generate extremely good pseudo random

sequence. The period of sequence is 2 raise to power n minus 1 (2n –1), where n is the number of

cells in the LFSR.

5.3 Applications of LFSR

1) Pseudo-random numbers

2) Pseudo-noise sequences

3) Fast digital counters

Page 25: Final Documentation

15

5.4 Logical Implementation of LFSR

Fig. 5.4.1: LLD (Low Level Design) of LFSR

Fig. 5.4.2: Architectural Implementation of Project

Page 26: Final Documentation

16

5.5 Uses in Cryptography

LFSRs have long been used as pseudo-random number generators for use in stream ciphers

and especially in military cryptography. It is also used in digital broadcasting and

communications to prevent short repeating sequences from spectral lines. The repeating

sequences of states of an LFSR allow it to be used as clock divider.

5.6 LFSR Based Stream-Ciphers - HLD

Binary stream ciphers are often constructed using linear feedback shift registers (LFSRs)

because they can also be implemented in hardware and can be readily analyzed mathematically.

Security can be upgraded through Clock controlled generators, Filter generators, and Non-linear

combining functions. As output of the project we would be creating a pseudo-random number

generator as the output.

Fig: 5.6.1 HLD of Client

Page 27: Final Documentation

17

Fig 5.6.2 HLD of Server

Page 28: Final Documentation

18

6. IMPLEMENTATION MODULES

Client Site Code:

import java.io.*;import java.net.*;import java.awt.*;import java.applet.*;import java.awt.event.*;

/*<applet code="FileSender" width=300 height=200></applet>*/

class SampleFrame extends Frame{ SampleFrame(String title) { super(title); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent we) { System.exit(0); } } ); }}

public class FileSender extends Applet implements ActionListener{ String msg, a; Label title; Label one; TextField name; Button browse, send; Graphics g1; public void init() { setBackground(Color.black); setForeground(Color.white); title = new Label(“Secure File Transfer"); add(title); one = new Label("File:"); name = new TextField(12); browse = new Button(" Browse "); send = new Button(" Send "); add(one); add(name); add(browse); browse.addActionListener(this); send.addActionListener(this); }

Page 29: Final Documentation

19

public void actionPerformed(ActionEvent ae) { String str = ae.getActionCommand(); if (str.equals(" Browse ")) { name.setText(null); setSize(300, 200); int flag = 0; Frame f = new SampleFrame("File Dialog Box "); f.setVisible(false); FileDialog fd = new FileDialog(f, "File Dialog"); fd.setVisible(true); msg = fd.getDirectory(); if (msg != null) { add(send); flag = 1; }

setSize(299, 199); a = fd.getFile(); msg += fd.getFile(); if (flag == 1) name.setText(msg); } if (str.equals(" Send ")) { try { Socket s = new Socket("localhost", 8080); InputStream is = new FileInputStream(msg); BufferedInputStream bis = new BufferedInputStream (s.getInputStream()); BufferedOutputStream bos = new BufferedOutputStream (s.getOutputStream()); PrintWriter pw = new PrintWriter(bos); int key = 0; pw.println(a); while ((key = is.read()) != - 1) { pw.print((char)key); System.out.print((char)key); pw.flush(); } pw.print(key); s.close(); remove(send); } catch (UnknownHostException e) { System.out.println("Hose Exception Caught");

} catch (IOException e) {

Page 30: Final Documentation

20

System.out.println("IO Exception Caught"); }}} public void start(){} public void paint(Graphics g) { showStatus("Vignette by Nikin Kumar Jain ");

}}

Server Site Code

import java.net.*;import java.io.*;

public class FileReceiver{ public static void main(String args[]) { try { ServerSocket ss = new ServerSocket(8080); Socket s = ss.accept(); BufferedReader bis = new BufferedReader(new InputStreamReader(s.getInputStream())); BufferedOutputStream bos = new BufferedOutputStream(s.getOutputStream()); InputStreamReader is = new InputStreamReader(s.getInputStream()); int n; String sr="a"; sr+=bis.readLine(); FileOutputStream fw = new FileOutputStream(sr); FileWriter fwi = new FileWriter(sr); System.out.println(sr); StringBuffer writer= new StringBuffer(); String writes =""; while((n=is.read())!=-1) { writes = writer.append((char)n).toString(); } fwi.write(writes); fwi.close(); s.close(); }catch(UnknownHostException e) { System.out.println(e); }catch(IOException e) { System.out.println("IOException Caught"); }

}}

Page 31: Final Documentation

21

7. MODULES-OUTPUT/RESULTS

7.1 File Encryption – Decryption

7.1.1 Applet Encryption Module

7.1.1.1 File Sender Applet

File Sender Applet: The File-Sender Applet is used for transfer of a file from Client to the

Server. Here we have a Browse Button and a Send Button. Both these button does their

functionality as their name signifies. Browse button opens a File Dialog Box where-as Send

Button is used for transferring of files from Client to Server Side.

7.1.1.2 File Sender Applet with Send Button

Page 32: Final Documentation

22

7.1.2 Command-Line File Encryption

7.1.2.1 File Encryption-Command Line Module

Command-Line Encryption: This module is used for running the applet-viewer along

with taking the data values for Encryption. It asks for the file name and the new encrypted file is

created.

7.1.2.2 File Encryption-Data Entry

Page 33: Final Documentation

23

7.1.3 Server-Side File Receivables

7.1.3.1 Server File Receivables

Server-Side File Receivables: Here the server-side is activated to receive file from client-

side. The Server receives the file once it-is encrypted.

Page 34: Final Documentation

24

8. Unit Testing and Integration Testing

8.1 Project Scheduling

Project scheduling is concerned with the techniques that can be employed to manage the

activities that need to be undertaken during the development of a project. Scheduling is carried

out in advance of the project commencing and involves:

1. Identifying the tasks that need to be carried out;

2. Estimating how long they will take;

3. Scheduling when the tasks will occur.

8.1.1 Table for Estimated Term of project

Page 35: Final Documentation

25

Gantt and Pert chart are being used to depict the scheduling process of this system. We

describe the technique.

8.2 PERT Chart

PERT (Project Evaluation & Review Technique) chart is a scheduling technique that also

shows graphically which tasks must be completed before others are begun. PERT controls time

and costs during the project and also facilitates finding the right balance between completing a

project on time and completing it within the budget. PERT recognizes that projects are complex,

that some tasks must be completed before others can start, and that the appropriate way to

manage a project is to define and control each task.

8.2.1 Pert Chart

1 2

3

4

5

6 87

9 10

Page 36: Final Documentation

26

9. Deployment and Acceptance Testing

9.1 Frame-Work Applied

We use the Microsoft Solution Frame-Work here for development of the software

Basic steps of Microsoft Solution Frame-Work are:

1. Envision a solution.

2. Plan the solution

3. Develop the solution

4. Test the solution.

5. Deploy the solution

9.2 Requirements

9.2.1 System Requirements: Since the product is using Java as a supporting language the

product will be portable and can work on operating systems which support JVM (Java Virtual

Machine). The system requires any platform supporting .Bmp, Gif, .Txt formats with minimum

RAM 64 Mb.

I. Design Constraint: The system requires O.S environments Windows 9x, 2000,

NT or XP.

II. Software Requirements: J2SE.

III. Hardware Requirements: Should be capable of supporting basic Networking.

9.3 Product perspective

The system is to be designed for the safest transfer of data across any two computers. The

product provides reliability and hence can be used for transfer of important documents without

being noticed.

9.4 Product function

The product provides the function of Encrypting the Data and then Inserting the encrypted

data in the Image at the source end and extracting the encrypted data and thereafter Decrypting

the message to obtain the data.

Page 37: Final Documentation

27

10. Conclusion I have developed with the support of my guide a comprehensive tool which can generate

pseudo-random sequence and this could be used in producing stream cipher and deciphering

product as the output. The development of digital computers and electronics made possible much more

complex ciphers. Many computer ciphers can be categorized by their operation on binary bit

sequences, unlike classical and mechanical schemes, which generally manipulate traditional

characters directly. We, the Developers need to be very much aware because of continuous

improvement in computer processing power have increased the scope of brute-force attack.

11. Future Enhancements

Our tool offers a two level security since it uses both data hiding and encryption. The tool is

compatible with the .txt, .rtf and .doc format of documents. The quality of the document does not

degrade with data hidden in it. We need to make the tool work much faster, so shall try to

improve space and time complexity of my algorithm used. Future work on this project can

improve this ratio. Another possible scope of improvement is to make this tool compatible with

the .gif, .jpeg, .dat, & .wav file formats and motion pictures formats which will enhance the

functionality of the tool.

12. Literature Survey and References

References:

1. Paper on Extended period LFSR using variable TAP function by Ariel Molina- Rueda and Team.

2. http://www.wikipedia.org/

3. L. B. M Blum and M. Shub. A simple unpredictable pseudo random number generator.

4. A. Menzes Handbook of applied Cryptography.

Page 38: Final Documentation

28

Appendix - A

Sample Encrypted and Decrypted Code:

Original Code:

Hello How Are You I am Nikin Kumar Jain it is a practice of hiding information. Modern Cryptography intersects the disciplines of mathematics, computer science and engineering. Application of cryptography includes ATM cards, computer passwords and electronic commerce. Cryptography is the process of converting ordinary information into cipher text. Decryption is the reverse, in other words, moving from the unintelligible cipher text back to plain text.

Encrypted Code:

r_VVU_rUM_{H__cUO_s_[W_tSQST_qOW[H_p[ST sN_SI_[_JH[YNSY__U\_RS^ST]_ST\UHW[NSUT_ wU^_HT_yHCJNU]H[JRC_STN_HI_YNI_NR__^SIYSJVST_I_U\_W[NR_W[NSYI__YUWJON_H_IYS_TY__[T^__T]ST__HST]_ {JJVSY[NSUT_U\_YHCJNU]H[JRC_STYVO^__{nw_Y[H^I__YUWJON_H_J[IIMUH^I_[T^__V_YNHUTSY_YUWW_HY__ yHCJNU]H[JRC_SI_NR__JHUY_II_U\_YUTL_HNST]_UH^ST[HC_ST\UHW[NSUT_STNU_YSJR_H_N_BN_ ~_YHCJNSUT_SI_NR__H_L_HI___ST_UNR_H_MUH^I__WULST]_\HUW_NR__OTSTN_VVS]SXV__YSJR_H_N_BN_X[YQ_NU_JV[ST_N_BN_

Decrypted Code:

Hello How Are You I am Nikin Kumar Jain it is a practice of hiding information. Modern Cryptography intersects the disciplines of mathematics, computer science and engineering. Application of cryptography includes ATM cards, computer passwords and electronic commerce. Cryptography is the process of converting ordinary information into cipher text. Decryption is the reverse, in other words, moving from the unintelligible cipher text back to plain text.