0% found this document useful (0 votes)
134 views98 pages

Yashwanth

This document appears to be a project report submitted by three students - K. Vandana, S. Yashwanth, and B. Ganesh - for their Bachelor of Computer Applications degree. The project topic is "Encryption Using Modulo Inverse Matrix Method". The report includes sections on introduction, literature survey, UML modeling, system design, implementation, testing, and conclusion. It was submitted to Gayatri Vidya Parishad College in partial fulfillment of the degree requirements.

Uploaded by

Chaitu Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
134 views98 pages

Yashwanth

This document appears to be a project report submitted by three students - K. Vandana, S. Yashwanth, and B. Ganesh - for their Bachelor of Computer Applications degree. The project topic is "Encryption Using Modulo Inverse Matrix Method". The report includes sections on introduction, literature survey, UML modeling, system design, implementation, testing, and conclusion. It was submitted to Gayatri Vidya Parishad College in partial fulfillment of the degree requirements.

Uploaded by

Chaitu Kumari
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 98

ENCRYPTION USING MODULO

INVERSE MATRIX METHOD


A project report submitted in partial fulfilment
of the requirements for the award of the Degree of

Bachelor of Computer Applications

Submitted By

K. Vandana (2017-1802021)

S. Yashwanth (2017-1802025)

B. Ganesh (2017-1802050)

Under the Esteemed Guidance of

Smt.U.Sahiti

Assistant Professor

Department of Computer Sciences & Applications

GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE AND P.G. COURSES

(AUTONOMOUS)
RUSHIKONDA, VISAKHAPATNAM.

2017-2020
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE and P.G
COURSES (Autonomous)

RUSHIKONDA, VISAKHAPATNAM
Department of Computer Application

CERTIFICATE

This is to certify that the project report titled “Encryption Using Modulo
Inverse Matrix Method” is the Bonafide record of project work carried out
by K. Vandana (Regd. No.2017-1802021), a student of this college, during the
academic year 2017-2020, in partial fulfilment of the requirements for the
award of the degree of Bachelor of Computer Applications.

Project Guide Head of the Department


Smt.U.Sahiti

Assistant Professor

External Examiner
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE and P.G
COURSES (Autonomous)

RUSHIKONDA, VISAKHAPATNAM
Department of Computer Application

CERTIFICATE

This is to certify that the project report titled “Encryption Using Modulo
Inverse Matrix Method” is the Bonafide record of project work carried out by
S. Yashwanth (Regd. No.2017-1802025), a student of this college, during the
academic year 2017-2020, in partial fulfilment of the requirements for the
award of the degree of Bachelor of Computer Applications.

Project Guide Head of the Department


Smt.U.Sahiti

Assistant Professor

External Examiner
GAYATRI VIDYA PARISHAD COLLEGE FOR DEGREE and P.G
COURSES (Autonomous)

RUSHIKONDA, VISAKHAPATNAM
Department of Computer Application

CERTIFICATE

This is to certify that the project report titled “Encryption Using Modulo
Inverse Matrix Method” is the Bonafide record of project work carried out by
B. Ganesh (Regd. No.2017-1802050), a student of this college, during the
academic year 2017-2020, in partial fulfilment of the requirements for the
award of the degree of Bachelor of Computer Applications.

Project Guide Head of the Department


Smt.U.Sahiti

Assistant Professor

External Examiner
DECLARATION

I, K. Vandana hereby declare that the project report entitled “Encryption


Using Modulo Inverse Matrix Method” is an original work done at Gayatri
Vidya Parishad College for Degree And P.G Courses (A), Visakhapatnam,
submitted in partial fulfilment of the requirements for the award of Bachelor of
Computer Applications, to Gayatri Vidya Parishad College for Degree And P.G
Courses (A), affiliated to Andhra University. I assure that this project is not
submitted in any other University or college.

(K. Vandana)
DECLARATION

I, S. Yashwanth hereby declare that the project report entitled “Encryption


Using Modulo Inverse Matrix Method” is an original work done at Gayatri
Vidya Parishad College for Degree And P.G Courses (A), Visakhapatnam,
submitted in partial fulfilment of the requirements for the award of Bachelor of
Computer Applications, to Gayatri Vidya Parishad College for Degree And P.G
Courses (A), affiliated to Andhra University. I assure that this project is not
submitted in any other University or college.

(S. Yashwanth)
DECLARATION

I, B. Ganesh hereby declare that the project report entitled “Encryption Using
Modulo Inverse Matrix Method” is an original work done at Gayatri Vidya
Parishad College for Degree And P.G Courses (A), Visakhapatnam,
submitted in partial fulfilment of the requirements for the award of Bachelor of
Computer Applications, to Gayatri Vidya Parishad College for Degree And P.G
Courses (A), affiliated to Andhra University. I assure that this project is not
submitted in any other University or college.

(B. Ganesh)
ACKNOWLEDGEMENT

I consider it as a privilege to thank all those people who helped me a lot


for successful completion of the project “Encryption Using Modulo Inverse
Matrix Method.”

First of all I would like to thank our beloved principal Prof. S. Rajani
of Gayatri Vidya Parishad College for Degree And P.G Courses(A), who
has provided full- fledged lab and infrastructure for successful completion of
my project work.

I would like to thank our ever-accommodating Head of the Department,


Bachelor of Computer Applications Sri P.Venkata Rao garu, and my guide
Assistant Prof. Smt.U.Sahiti, who has obliged in responding to every request
though they are busy with their hectic schedule of administration and teaching.

I thank all the Teaching & Non-Teaching staff who has been a constant
source of support and encouragement during the study tenure.

(K. Vandana)
ACKNOWLEDGEMENT

I consider it as a privilege to thank all those people who helped me a lot


for successful completion of the project “Encryption Using Modulo Inverse
Matrix Method.”

First of all I would like to thank our beloved principal Prof. S. Rajani
of Gayatri Vidya Parishad College for Degree And P.G Courses(A), who
has provided full- fledged lab and infrastructure for successful completion of
my project work.

I would like to thank our ever-accommodating Head of the Department,


Bachelor of Computer Applications Sri P.Venkata Rao garu, and my guide
Assistant Prof. Smt.U.Sahiti, who has obliged in responding to every request
though they are busy with their hectic schedule of administration and teaching.

I thank all the Teaching & Non-Teaching staff who has been a constant
source of support and encouragement during the study tenure.

(S. Yashwanth)
ACKNOWLEDGEMENT

I consider it as a privilege to thank all those people who helped me a lot


for successful completion of the project “The Tiny Encryption Algorithm.”

First of all I would like to thank our beloved principal Prof. S. Rajani
of Gayatri Vidya Parishad College for Degree And P.G Courses(A), who
has provided full- fledged lab and infrastructure for successful completion of
my project work.

I would like to thank our ever-accommodating Head of the Department,


Bachelor of Computer Applications Sri P.Venkata Rao garu, and my guide
Prof. .I.S.Pallavi, who has obliged in responding to every request though they
are busy with their hectic schedule of administration and teaching.

I thank all the Teaching & Non-Teaching staff who has been a constant
source of support and encouragement during the study tenure.

(B. Ganesh)
ENCRYPTION USING
MODULO INVERSE
MATRIX METHOD
Content

Topic Page no

------------------------------------------------------------------------------------------------------------------------

1. Introduction 1

2. Literature Survey 5

2.1. Introduction 6

2.2. Current system 6

2.3 Problem statement 6

2.4 Proposed system 6

2.5 Objectives 6

2.6 Requirement Elicitation 7

2.6.1 Functional requirements 8

2.6.2 Non-functional Requirements 9

2.7 Software and technologies description 10

3. UML Modelling 16

3.1 Introduction to Use Case Diagram 19

3.1.1 Actors 19

3.1.2 Use –Case Diagram 20


3.2 Introduction to Use Sequence Diagram 24

3.2. 1 Sequence Diagram 25

3.3 Introduction to Use Activity Diagram 27

3.3.1 Activity Diagram 28

4. Design 30

4.1. Design and Description of the Algorithm 31

4.2. Example 35

5. Coding 39

5.1. Coding Approach 40

5.2 Information Handling 40

5.3 Programming Style 41

5.4 Verification and Validation 41

5.5 Sample Source Code 42

6. Testing 59

6.1. Testing Activities 60

6.2. Testing type 62

6.3. Testing plan 65

6.4. Test Case Report 66

7. Results 68

7.1. Result 69
7.2. Conclusion 74

8. References 75

8.1. Research References 76

8.2. Book Reference 77

9. Appendix 78

9.1. List of Tables 79

9.2. List of Figures 80


ABSTRACT

Encryption and decryption of a message by using a matrix is mainly focused on


converting a plain text into cipher text by using a key matrix and decrypting the
cipher text into plain text by using a inverse matrix and Modulo Method. This
method is secured way to transfer a message from sender to receiver.
INTRODUCTION
1. INTRODUCTION
1.1. Introduction

The basic idea of cryptography is that information can be encoded using an encryption
scheme and decoded by anyone who knows the scheme. There are lots of encryption
schemes ranging from very simple to very complex. Most of them are mathematical in
nature.

It's not difficult to guess at the importance of this application. It is surmised that Hitler
may well have won WWII had not a bright British mathematician been able to break the
codes used by the Axis forces in their radio transmissions. Today, sensitive information
is sent over the Internet every second: credit card numbers, personal information, bank
account numbers, letters of credit, passwords for important databases, etc. Often, that
information is encoded or encrypted.

We are going to play with matrix encryption. The encoder is a matrix and the decoder is
it's inverse. Let's see just how that works. Let A be the encoding matrix, M the message
matrix, and X will be the encrypted matrix. Then, mathematically, the operation is

2.

(Note, the sizes of A and M will have to be consistent and will determine the size of X.)
OK, let's say someone has X and knows A. and wants to recover M, the original
message. That would be the same as solving the matrix equation for M. Multiplying both
sides of the equation on the left by   we have

3.

Notice then that the encoding matrix, A, must have an inverse for this scheme to work.

1.2 Steps for encryption using matrix

Step 1: Letters to Numbers

Select a message . Now you need to convert it to numerical format. An underbar (_) is a
space ( ).

0=_
1=A
2=B
3=C
4=D
5=E
6 = F
7 = G
8 = H
9 = I
10 = J
11 = K
12 = L
13 = M
14 = N
15 = O
16 = P
17 = Q
18 = R
19 = S
20 = T
21 = U
22 = V
23 = W
24 = X
25 = Y
26 = Z

For my message, I will use "send help".

So it would look like, SEND_HELP_

Notice the space on the end. This is because you must have an even number of characters,
because of how the encryption works (in groups of two letters).

When the letters are changed to numbers, my message reads as:


19,5,14,4,0,8,5,12,16,0

But , we are doing this with matrixes and letters in groups of two, so it will be better if you
write it in this format:
[19 5] [14 4] [0 8] [5 12] [16 0]

Step 2: The Key

We now need a four integer key. For example,


[4 3]
[5 -3]

You can’t use zeroes. Otherwise, you can use any integer, but the bigger the numbers, the
harder it will be to multiply out by hand.

Step 3: Multiply

Now, you have to multiply. This involves math.

We have the message:


[19 5] [14 4] [0 8] [5 12] [16 0]

and the key:


[4 3]
[5 -3]

To make this easier to write, lets name our matrices.


We will call the key [K].
[19 5] can be [A1]
[14 4] can be [A2]
[0 8] can be [A3]
[5 12] can be [A4]
and [16 0] can be [A5]

We will call the results [B''n''], where n matches the [A''n''] matrices.

Now, we multiply like this:


[A''n''] * [K] = [B''n'']
[A1] * [K] = [B1]
[B1] = [101 42]

Once you multiply out you matrixes, you get the encoded results.
[B1] = [101 42]
[B2] = [76 30]
[B3] = [40 -24]
[B4] = [80 -21]
[B5] = [64 48]
The picture in this step demonstrates how matrix multiplication works.

Step 4: Rewrite

From the previous step, we got:


[B1] = [101 42]
[B2] = [76 30]
[B3] = [40 -24]
[B4] = [80 -21]
[B5] = [64 48]

You can rewrite this as:


101, 42, 76, 30, 40, -24, 80, -21, 64, 48

Now you have an encrypted message!

Step 5: Decryption

To encrypt your message, we used:


[A''n''] * [K] = [B''n'']

Well, to decrypt it, we use


[B''n''] * [K]-1 = [A''n'']

[K]-1 is the inverse of [K].

Example 2:-

Let us take, plain text as GVP COLLEGE

Write the plain text in alphabetic number order and every space after a word will count as
underscore (_) and the underscore will count as ‘0’.

Every two number are taken as 1*2 matrix.


So, then A1= [7 22]A2= [16 0]A3=[3 15]A4= [12 12] A5=[5 7] A6=[5 0]

By now using matrix key we have to encrypt the plain text to cipher text.

(There is no rules for take a particular key, We can assume any random 2*2 matrix.

A1*K=B1=[21+22 49+44]=4[43 93]

A2*K=B2=[48+0 112+0]=[48 112]

A3*K=B3=[9+15 21+30]=[24 51]

A4*K=B4=[36+12 84+24]=[48 108]

A5*K=B5=[15+7 35+14]=[22 49]

A6*K=B6=[15+0 35+0]=[15 35]

The cipher text message is 43 93 48 112 24 51 48 108 22 49 15 35.

The cipher text message is 43 93 48 112 24 51 48 108 22 49 15 35.

Now the receiver have to decrypt the message by using inverse matrix key

The inverse matrix key is

By using inverse matrix key the receiver have to decrypt to cipher text

B1*k= A1= [86-93 -301+279] = [7 22]

B2*K=A2= [96-112 -336+336] = [16 0]

B3*K=A3= [48-51 -168+153] = [3 15]

B4*K=A4= [96-108 -336+324] = [12 12]


B5*K=A5= [44-49 -154+147] = [5 7]

B6*K=A6= [30-35 -105+105] = [5 0]

The [7 22][16 0][3 15][12 12][5 7][5 0]

The receiver will get plain text.


LITERATUIRE SURVEY
4. LITERATUIRE SURVEY

2.1 Introduction

To encrypt a message, each block of n letters (considered as an n-component vector) is


multiplied by an invertible n × n matrix, against modulus 26. To decrypt the message, each
block is multiplied by the inverse of the matrix used for encryption.

ALGORITHM

Enter the message or plaintext.

a. Divide the plaintext into two consecutive letters.


b. Convert them into corresponding vector matrix.
c. Take any matrix mod 27 which is used as key.
d. Multiply the key with the vector matrix.
e. Cipher text obtained.

EXAMPLE

Use the key matrix, Let A= 3 1

56

Plaintext: “MY NAME IS VANDANA.”

MY_NAME_IS_VANDANA

Divide the plaintext into two consecutive letters.


AM=X

A= CODING

M=MESSAGE

C=CIPHERTEXT

PLAINTEXT= “MY NAME IS VANDANA”

CIPHEREXT= JZNCPBOYSXVXQHDZPX
Decrypting the cipher text :

M=A-1 X

M1 = A-1 X
Rearranging the above letters in an order we get,

MY NAME IS VANDANA

Therefore, PLAINTEXT=CIPHERTEXT

2.2 Current System:

A key is used to convert plaintext to ciphertext and vice versa. So this system more
chances for ciphertext to break the text.

In this system there are more chances to break the text.

Example: plaintext =BCA

Key: 7

Ciphertext = HIG

2.3 Problem Statement:

Here the encryption technique used can be easily decrypted by hacker and they can
misuse the information for malicious activities.It creates more memory footprint and Slower in
speed.

2.4 Proposed System:

Encryption and decryption of message by using a matrix is focused on converting a plaintext


into Cipher text by using a matrix mod 27 as key. Decryption is done using inverse matrix
mod 27 as key. This is secured way to transfer a message from sender to receiver.
2.5 Objectives:

The objectives of the program are as follows:

 Minimise memory footprints.


 Increase speed.
 Provide security to the data.
 Reduced memory usage.
 Ease of application

2.6 Requirements Elicitation:

Requirement is the feature the system must have a constraint that it must satisfy to be
accepted by the clients. Requirements engineering aims at defining the requirements of the
system under construction. It includes two main activities namely Requirements Elicitation
and Analysis.

Requirements Elicitation focuses on describing the process of the system. The client,
the developer and the users identify the problem. Such a definition is called Requirement
Specification. This specification is structured and formulized during analysis to produce an
Analysis Model.

Requirements Elicitation and Analysis focuses only on the user’s view of the system.
Requirements Elicitation includes the following activities:

2.6.1 Identifying Actors:

During this activity, developers identify the different types of users the future system will
support.

2.6.2 Identifying Scenarios:

During this activity, developers observe users and develop a set if detailed scenarios for
typical functionality provided by the future system. Developers use these scenarios to
communicate with the users and deepen their understanding.
2.6.3 Identifying Use Cases:

Once developers and users agree on the set of scenarios, a set of use cases that completely
represent the future system.

2.6.4 Refining Use Cases:

During this activity, developers ensure that the requirements specifications completed
bydetailing each use case and describing the behavior of the system in the presence of errors
and exceptional conditions.

2.6.5 Identifying Relationships Among Use Cases:

During this activity, developers identify the dependencies among the use cases and also
consolidate the use case model by factoring out common functionality.

2.6.6 Identifying Non-functional Requirements:

During this activity, developers, users and clients agree on aspects like performance of
system, documentation, resources, security and its quality.

2.6.6.1 Actors: Actors are external entities that interact with the system. Actors typically

include a user role or Actors typically include a user role or Actors typically include a user

role or another system. They have a unique names and descriptions.

Sender receive
r
In this project the two actors are sender and receiver.
2.6.7 Functional Requirements:

The Functional requirement of the system defines a function of software or components. A


function is described as a set of inputs, behaviour of a system and output.

Sender

Input : Plain text, key

Output : Cipher text

Receiver

Input : Cipher text, key

Output : Plain text

2.6.8 Non-functional Requirements :

A Non-functional requirement in software engineering is systematic approach to


‘building quality into software’.
 Graphical User Interface : The GUI of this system provides an easy access to user
and user can get good result for the given input.
 Robustness :This system functions in the presence of invalid inputs and displays
message to provide a valid input.
 Security :This system provides security for data by using matrix and inverse matrix
as a key.
 Implementation : Core java.
 Portability : System can work on any platform.

2.6.8.1 Hardware Requirements:

The hardware requirements to run this system are:

RAM : 4GB

Hard disk : 500GB


Monitor : User’s choice

Keyboard : Standard Keyboard

Mouse : Standard

2.6.8.2 Software Requirements:

The minimum software requirements to run this system are:

Operating system : Windows 7 and above

Programming language : Core Java

2.7 Software and technologies description:

2.7.1 About Java

Java is a cross-platform object-oriented programming language that was released by Sun


Microsystems in the year 1995. Today, Java is needed to run various applications such as
games, social media applications, audio and video applications, etc. 

Applications of java
History 
Java is a programming language developed by James Gosling with other team members
named Mike Sheridan and Patrick Naughton also called as Green Team in 1995 for Sun
Microsystems for digital devices such as set-top boxes, televisions etc. Now, let us explore
the language in detail.

What is Java?
It is an object-oriented language similar to C++, but with advanced and simplified features.
This language is free to access and can run on all platforms.

Java is: –

 Concurrent where you can execute many statements instead of


sequentially executing it.
 Class-based and an object-oriented programming language.
 Independent programming language that follows the logic of “Write once, Run
anywhere” i.e. the compiled code can run on all platforms which supports java.

In simple words, it is a computing platform where you can develop applications.

Features 

Simple: Java has made life easier by removing all the complexities such as
pointers, operator overloading as you see in C++ or any other programming language.

 
Portable: This is platform independent which means that any application
written on one platform can be easily ported to another platform.

  Object-oriented: Everything is considered to be an “object” which


possess some state, behavior and all the operations are performed using these objects. 

Secured: All the code is converted in bytecode after compilation, which is


not readable by a human. and java does not use an explicit pointer and run the programs
inside the sandbox to prevent any activities from untrusted sources. It enables to develop
virus-free, tamper-free systems/applications.

  Dynamic: It has the ability to adapt to an evolving environment which


supports dynamic memory allocation due to which memory wastage is reduced and
performance of the application is increased.

Distributed: This language provides a feature which helps to create


distributed applications. Using Remote Method Invocation (RMI), a program can invoke a
method of another program across a network and get the output. You can access files by
calling the methods from any machine on the internet.
  Robust: Java has a strong memory management system. It helps in
eliminating error as it checks the code during compile and runtime.

   High Performance: Java achieves high performance through the use of


bytecode which can be easily translated into native machine code. With the use of JIT (Just-
In-Time) compilers, it enables high performance. 

   Interpreted: Java is compiled to bytecodes, which are interpreted by a


run-time environment.

Multithreaded: Java supports multiple threads of execution (a.k.a.,


lightweight processes), including a set of synchronization primitives. This makes
programming with threads much easier.

Components
JVM (Java Virtual Machine)

It is an abstract machine. It is a specification that provides a run-time environment in


which the bytecode can be executed. It follows three notations:

 Specification: It is a document that describes the implementation of the JVM. It is


provided by Sun and other companies.
 Implementation: It is a program that meets the requirements of JVM specification.
 Runtime Instance: An instance of JVM is created whenever you write a command on
the command prompt and run the class.
JRE (Java Runtime Environment)

JRE refers to a runtime environment in which bytecode can be executed. It implements the


JVM and provides all the class libraries and other support files that JVM uses at runtime. So
JRE is a software package that contains what is required to run a program. Basically, it’s an
implementation of the JVM which physically exists. 

Java, J2EE & SOA Certification Training


JDK(Java Development Kit)
It is the tool necessary to:-

 Compile
 Document
 Package Java programs.

The JDK completely includes JRE which contains tools for programmers. The Development
Kit is provided free of charge. Along with JRE, it includes an interpreter/loader, a compiler
(javac), an archiver (jar), a documentation generator and other tools needed in Java
development. In short, it contains JRE + development tools.
3.UML MODELING

3.1 Introduction to UML:

The Unified Modeling Language (UML) is now a well-recognized graphical


modeling language for Object-Oriented software engineering. UML has been widely
used by software engineers for the specification, construction and documentation of
software systems. It was based on the work of three most reputable modeling experts:
Grady Booch, Ivar Jacobson and James Rumbaing on Object-Oriented software
engineering over the past decade. UML provides a systematic way of describing a
system’s architecture, capturing its static, functional and dynamic views in detail. Using
UML, system analysts, designers and programmers can build and maintain a complex
software system much more easily and, at the same time, ensure that the system will hold
up to requirement change.

One of the purposes of UML was to provide the development community with a
stable and common design language that could be used to develop and build computer
applications. UML years. Using UML, IT professionals could now read and disseminate
system structure and design plans -- just as construction workers have been doing for
years with blueprints of buildings.

I. UML Standard Diagrams:

The elements are like components which can be associated in different ways to make
complete UML pictures which is known as diagram. So it is very important to understand the
different diagrams to implement the knowledge in real life systems.

Any complex system is best understood by making some kind of diagrams or


pictures. These diagrams have a better impact on our understanding. So if we lookaround
then we will realize that the diagrams are not a new concept but it is used widely in different
form in different industries.

We prepare UML diagrams to understand a system in better and simple way. A single
diagram is not enough to cover all aspects of the system. So UML defines various kinds of
diagrams to cover most of the aspects of a system.

1
7
You can also create your own set of diagrams to meet your requirements. Diagrams
are generally made in an incremental and iterative way.

There are two broad categories of diagrams and then are again divided into sub-categories:

 Structural Diagrams
 Behavioral Diagrams
i. Structural Diagrams:

The structural diagrams represent the static aspect of the system. These static aspects
represent those parts of a diagram which forms the main structure and therefore stable.

These static parts are represents by classes, interfaces, objects, components and
nodes. The four structural diagrams are:

 Class diagram
 Object diagram
 Component diagram
 Deployment diagram

ii. Behavioral Diagram:

Any system can have two aspects, static and dynamic. So a model is considered as complete
when both the aspects are covered fully.

Behavioral diagrams basically capture the dynamic aspect of a system. Dynamic


aspect can be further described as the changing/moving parts of a system.

UML has the following five types of behavioral diagrams:

 Use case diagram


 Sequence diagram
 Collaboration diagram
 State chart diagram

 Activity diagram

1
8
3.1 Introduction to Use case diagram:

A use case diagram at its simplest is a representation of a user's interaction with the system
and depicting the specifications of a use case.

A use case diagram can portray the different types of users of a system and the
various ways that they interact with the system. This type of diagram is typically used in
conjunction with the textual use case and will often be accompanied by other types of
diagrams as well.

3.1.1 Actors

Actor:

Actors are external entities that interact with the system. Actors typically include a user role
or another system. They have unique names and descriptions.

sender receiver

Fig 3.1.1.:sender actor Fig 3.1.2:receiver actor

Sender:

The sender sends the message to the user which is encrypted using matrix. The sender gives
the receiver a key to later encrypt the message.

Receiver:

He/she receive the encrypted message which is decrypted using the key shared by sender.

Without the key he/she cannot decode the message.

3.2 Use Cases Diagram:


Use cases describe the behaviour of the system as seen from the actor’s point of view. It
describes the function provided by the system as a set of events that yield a visible result for
the actors.

Actors initiate the use cases for accessing system’s functionality. When actors and use
cases exchange information, they are said to Communicate. To describe a use case we use a
template composed of six fields:

Use Case Name : The name of the use case

Participating Actors : The actors participating in the particular use case

Entry Condition : Condition for initiating the use case.

Flow of events : Sequence of steps describing the functioning of use


case.

Exit Condition : Condition for terminating the use case.

3.3 Quality Requirements:

Requirements that do not belong to the use case but Constraint the functionality of the
system.

Use case diagrams include four types of relations. They are as follows:

 Communication Relationships

 Inclusion Relationships
 Extension Relationships
 Inheritance Relationships
3.4 USE CASE DIAGRAM

Description: In the use case diagram, initially the message sent by the sender is encrypted
using already generated matrix key then the ciper text is transported to receiver through
network where he/she decrypts it using the same key.

Scenario

A Scenario is an instance of a use case describing a concrete set of actions. Scenarios are
used as examples for illustrating common cases: their focus is on understandability.

A Use Case Scenario is a description that illustrates, step by step, how a user is
intending to use a system, essentially capturing the system behavior from the user's point of
view. A use case scenario can include stories, examples, and drawings. Use cases are
extremely useful for describing the problem domain in unambiguous terms and for
communicating with the potential users of a system.

Scenario Name : The name of the Scenario

Participating Actors : The Instances of the actors participating in the


Scenario.

Flow of events : Sequence of steps describing the events in Scenario

1. use case 1:

Encryption use case 1:

Scenario 1:

Use Case Name Encryption


Participating Actors Sender: The person who sends the Encrypted text.
1. Generate matrix keys.
Flow of Events
2. Enter/browse the message.

3.Select key/generate key.

4. Encrypt the message.

5. Send the encrypted message and keys.

Table 3.4.1 Scenario: encryption

Decryption Use Case:

Scenario 2:

Use Case Name Decryption

Participating Actors Receiver: The person who receives the Encrypted text.
1. Receive the keys and encrypted text.
Flow of Events
2. Browse the message.

3. Decrypt the message.

4. Generate the plain text.

Table 3.4.2: Scenario: Decryption

3.5 Introduction to Sequence Diagram:

Interaction diagrams model the behaviour of use cases by describing the way groups of
objects interact to complete the task. The two kinds of interaction diagrams are Sequence and
Collaboration diagrams. Sequence diagrams generally show the sequence of events that
occur. Sequence diagrams demonstrate the behaviour of objects in a use case by describing
the objects and the messages they pass. The diagrams are read left to right and descending.
Following are the Sequence Diagrams for the system under consideration.

In object-oriented analysis, developers build a model describing the application


domain. The analysis model is then extended to describe how the actors and the system
together with non-functional requirements, to prepare the architecture of the system
developed during high-level design, which is correct, complete, consistent and verifiable.

Analysis object model is represented by class and object diagrams. Analysis focuses
on producing a model of the system, called the analysis model, which is correct, complete,
consistent, and verifiable. Analysis is different from requirements elicitation in that
developer’s focus on structuring and formalizing the requirements elicited from users. This
formalization leads to new insights and discovery of errors in the requirements. As the
analysis model may not be understandable to the users and the client, developers need to
update the requirements specification to reflect insights gained during analysis, and then
review the changes with the client and users. In the end, the requirements, however large,
should be understandable by the client and the users.
The analysis model is composed of three individual models: the functional model
represented by use cases and scenarios, the analysis, represented by class and object
diagrams, and the dynamic model, represented by state chart and sequence diagrams. We
described how to elicit requirements from the users and describe them as use cases and
scenarios. We describe how to refine the functional model and derive the object and the
dynamic model. This leads to a more precise and complete specification as details is added to
the analysis model. We conclude by describing management activities related to analysis.

3.5.1 Sequence Diagram:

Interaction between objects can be described by means of sequence diagrams. An object


interacts with another object by sending messages. The reception of a message by an object
triggers the execution of an operation, which in turn may send messages to other objects.
Arguments may be passed along with a message and are bound to the parameters of the
executing operation in the receiving object. Typically, we use a sequence diagram to
encdescribe the event flow of a use case, identify the objects that participate in the use case,
and assign pieces of the use case behaviour to the objects in the form of services.

Sequence diagrams describe interactions among classes in terms of an exchange of


messages over time.
3.5.1.1 Sequence diagram for encryption using modulo inverse matrix method
Description:

Here the sender sends the message to the receiver . When sender sends the
plain text it is converted into cipher text using the generated matrix key .The key is shared
with the receiver.

3.5.1.2 Sequence diagram for encryption using modulo inverse matrix method

Description : Here receiver receives the ciper text then ,he/she converts into plain text using
matrix key.

3.6 Introduction to State-Chart Diagram:

State diagrams are used to describe the behaviour of a system.  State diagrams describe all of
the possible states of an object as events occur.  Each diagram usually represents objects of a
single class and tracks the different states of its objects through the system. Not all classes
will require a state diagram and state diagrams are not useful for describing the collaboration
of all objects in a use case.  State diagrams have very few elements.  The basic elements are
rounded boxes representing the state of the object and arrows indicting the transition to the
next state.  The activity section of the state symbol depicts what activities the object will be
doing while it is in that state. All state diagrams being with an initial state of the object.   This
is the state of the object when it is created.  After the initial state the object begins changing
states. 

Control flow is the sequencing of actions in a system. It defines the order of execution
of operations. These decisions are based on external events generated by an actor or on the
passage of time.

Activity diagrams illustrate the dynamic nature of a system with modelling the flow
of control from activity to activity. In many ways Uml activity diagrams are the object-
oriented equivalent of flow charts and data-flow diagrams (DFD’s) from structured
development. They are used to explore the logic of:

 A complex operation
 A complex business rules
 A single use case
 Several use cases
 A business process
 Software processes

3.6.1 State Chart Diagram:

An activity represents an operation on some class in the system that results in a change in the
state of the system. Typically, activity diagrams are used to model workflow of business
processes and internal operation
3.6.1.1 Activity diagram for encryption using modulo inverse matrix method

Description: Here the sender sends the message to the receiver . When sender sends the plain
text it is converted into cipher text using the generated matrix key and mod 27.The key is
shared with the receiver. When the receiver receives the ciper text he/she converts into plain
text using key.
4. DESIGN

4.1 Design and description of Algorithm:

4.1.1 Introduction to Design

Design is the first step in development phase. It is the first step into the solution domain. The
analysis and specification deals with the problem domain. Analysis deals with what a
proposed system has to do, where design deals with how the system implements. It can be
defined as "the process of applying various techniques and principles for the purpose of
defining a device, a process or a system in sufficient detail to permit its physical realization".

4.1.2 Technical criteria for design

A design should exhibit a hierarchical organization that makes intelligent use of control
among element of software. A design should be modular that is the software should be
logically partitioned into elements that perform specific functions and sub functions. A
design should contain both data and procedural abstractions. A design should lead to
modules that exhibit independent functional characteristics A design should lead to interface
that reduce the complexity of connections between modules and with the external
environment A design should be derived using a repeatable method that is driven by
information obtained during the software requirements analysis.

4.1.3 Design Principles

Software design is both a process and a model. The design process is a set of iterative steps
that enable the designer to describe all aspects of the software to be built. Basic design
principles enable the software engineer to navigate the design process. Some of the Design
Principles are

 The design should be traceable


 The design not reinvents the wheel
 The design should "minimize the intellectual distance between and the
problem as it exists in the real world"
 The design should exhibit uniformity and integration

3
1
Design methodology is a systematic approach to create a design by applying a set of
techniques and guidelines. Most design methodologies focus on the system design. Problem
partitioning is a basic principle for guiding the design process. The goal is to effectively
handle the complexity involved in designing large systems, by partitioning their problem into
separate pieces so that each piece can be solved separately. Problem partitioning depends on
the effective use of abstraction. Abstraction of a component is a view of the component that
extracts the essential information relevant to particular focus and ignores the rest of the
information. It allows a module to be specified by its external behaviour only. Abstraction
permits concentrating on one component at a time by using the abstraction of other
components to decide the interaction between the components. Design is the first step in the
development phase for any system .it is the first of the three technical activities design; code
generation and testing that are required to build and verify the software. The design step
produces a data design, an architectural design an interface design and procedural design.
The data design transforms the information domain model created during the analysis into the
data structures that will be required to implement the software. The data objects and the
relationships defined in the data dictionary provide the basis for the design activity. The
architectural design defines the relationship among major structural elements of the program.
The interface design describes how the software communicates with itself, to systems that
interoperate with it, and humans who use it. The procedural design transforms the structural
elements of the programs architecture into procedural description of the software
components. Design is the only way that we accurately translate a customer's requirements
into finished software product or system. Without design we risk in building an unstable
system-one that will fail when small changes are made; one that may be difficult to test; one
whose quality cannot be accessed until late in the software engineering process, then time is
short and many dollars have been spent.
CODING
5. CODING

The goal of the coding or programming phase is to translate the design of the system
produced during the design phase into code in a given programming language, which can be
executed by a computer and that performs the computation specified by the design.

The coding phase affects both testing and maintenance. The goal of coding is not to
reduce the implementation cost but the goal should be to reduce the cost of later phases. In
other words the goal is not to simplify the job of programmer. Rather the goal should be to
simplify the job of the tester and maintainer.

5.1 Coding Approach:

There are two major approaches for coding any software system. They are Top-Down
approach and bottom up approach.

Bottom-up Approach can best suit for developing the object-oriented systems. During
system design phase of reduce the complexity. We decompose the system into an appropriate
number of subsystems, for which objects can be modelled independently. The Once objects
have been modelled they are implemented by means of coding. Even though related to the
same system as the objects are implemented of each other the Bottom-Up approach is more
suitable for coding these objects.

In this approach, we first do the coding of objects independently and then we integrate
these modules into one system to which they belong. In this System Entire Website was built
into different pages.

5.2 Information Handling:

Any software system require some amount of information during its operation selection of
appropriate data structures can help us to produce the code so that objects of the system can
better operate with the available information decreased complexity.

The system handled information in Static Strings. For every intermediate stage, the
Cookies are built in every page to make security purpose. The system transforms this

4
0
information carefully from one page to another. This also helps in Reducing Burden on
server.

5.3 Programming Style:

Programming style deals with act of rules that a programmer has to follow so that the
characteristics of coding such as Trace ability, Understand ability, Modifiability, and
Extensibility can be satisfied. As part of coding internal documentation is also provided that
help the readers to better understand the code

In my system, for every independent action statements, one method is created. Before
using any variable, our system checks whether this value is null so we can rectify the problem
of abnormal program termination.

5.4 Verification and Validation:

Verification and Validation of the system is integrated into the system while it is
coded. All the code is tested using the Netbeans framework for unit level perfection at the
time of coding. However various tests and test cases are designed to employ on the system
for its effectiveness and efficiency.

Validations applied to the entire system at two levels:

5.4.1 Form level Validation:

Validation of all the inputs given to the system at various points in the forms are validated
while navigating to the next form. System raises appropriate custom and pre-defined
exceptions to alert the user about the errors occurred or likely to occur.

5.4.2 Field level Validation:

Validations at the level of individual controls are also applied wherever necessary. System
pops up appropriate and sensuous dialogs wherever necessary.

4
1
5.5 Sample Source Code:
#-------------------------------------------------------------------
#about page
#-------------------------------------------------------------------
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
public class AboutPage extends JFrame implements ActionListener
{
JPanel p1,p2,p3;
JLabel l1,l2,l3,l4,l5,l6;
JButton b1,b2;

AboutPage()
{
setTitle("AboutUs Page");
setLayout(null);

p1 = new JPanel();
p1.setLayout(null);
p1.setBounds(0,0,1100,150);
p1.setBackground(Color.white);

p2 = new JPanel();
p2.setLayout(null);
p2.setBounds(0,200,1100,500);
p2.setBackground(new Color(150,230,250));

p3 = new JPanel();
p3.setLayout(new FlowLayout());
p3.setBounds(0,150,1100,50);
p3.setBackground(Color.black);

//Image image=GenerateImage.toImage(true); //this generates an image


file
ImageIcon icon = new
ImageIcon("C:/Users/raju/Downloads/UG/Matrix/image.jpeg");
l1= new JLabel();
l1.setIcon(icon);

l2= new JLabel();


l2.setForeground(Color.white);
l3= new JLabel("ENCRYPTION USING MATRICES");
l3.setForeground(Color.white);
l2.setFont(new Font("Serif", Font.BOLD, 50));
l3.setFont(new Font("Serif", Font.BOLD, 30));
l1.setBounds(0,0,6000,150);
l2.setBounds(100,0,1100,150);
b1 = new JButton("HOME");
b2 = new JButton("CLOSE");

b1.setFont(new Font("Serif", Font.BOLD, 20));


b2.setFont(new Font("Serif", Font.BOLD, 20));

l3.setBounds(100,-30,1090,150);

b1.setBounds(400,380,150,50);
b2.setBounds(560,380,150,50);

b1.addActionListener(this);
b2.addActionListener(this);

String names="<html><h1><u><b>TEAMS<b><u></h1><h2>A.
HEAMANTH : 2017-1802012\r\n" +
"</h2><h2>CH. KISHORE : 2017-1802020 </h2><h2>T. S. SAI
PRASHANTH : 2017-1802034 </h2><html>";
String name="<html><h1><u><b>PROJECT
GUIDE:</b></u></h1><h2>Smt. M. LAKSHMI MADHURI </h2><h2>ASSISTANT
PROFESSOR</h2><h3>Dept. of Computer Applications\r\n" +
"</h3></html>";
l5= new JLabel(names);
l6= new JLabel(name);

l5.setBounds(100,120,500,300);
l6.setBounds(750,120,500,300);

l4= new JLabel("Thank You");


l4.setFont(new Font("Serif", Font.BOLD, 100));
l4.setForeground(Color.red);
l4.setBounds(300,50,500,150);
p2.add(l4);

p1.add(l1);
p1.add(l2);
p3.add(l3);
p2.add(l5);
p2.add(l6);

p2.add(b1);
p2.add(b2);

add(p1);
add(p2);
add(p3);
setSize(1100, 700);

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();


// Determine the new location of the window
int w = this.getSize().width;
int h = this.getSize().height;
int x = (dim.width-w)/2;
int y = (dim.height-h)/2;

// Move the window


this.setLocation(x, y);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}
public void actionPerformed(ActionEvent ae)
{
if(ae.getSource()== b1)
{
new HomePage();
setVisible(false);
}
if(ae.getSource()== b2)
{
System.exit(0);
}
}
public static void main(String s[])
{
new AboutPage();
}
}

---------------------------------------------------------------------------------------------------------------------------------------
Decryption
-------------------------------------------------------------------------------------------------------------
import java.io.*;
import java.util.*;
import java.awt.*;
import javax.swing.*;
import java.awt.event.*;

public class DecryptionPage extends JFrame implements ActionListener


{
int arr[],Mat[][]=new int[2][2],Mat2[][];
int Inv[][]=new int[2][2],C[][];
int q1=0,q2=0,q3=0,q4=0,m,n,p,q;
String ct="",key="",s1="",s2="",ct1="";
JPanel p1,p2,p3;
JLabel l1,l2,l3,l4,l5,l6,l7,l8,l9,l10,l11,l12,l13,l14,l15,l16,l17;
JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11;
JTextArea jt1,jt2,jt3;

DecryptionPage()
{
setTitle("Decryption Page");
setLayout(null);

p1 = new JPanel();
p1.setLayout(null);
p1.setBounds(0,0,1100,150);
p1.setBackground(Color.white);

p2 = new JPanel();
p2.setLayout(null);
p2.setBounds(0,200,1100,500);
p2.setBackground(new Color(150,230,250));

p3 = new JPanel();
p3.setLayout(new FlowLayout());
p3.setBounds(0,150,1100,50);
p3.setBackground(Color.black);

//Image image=GenerateImage.toImage(true); //this generates an image file


ImageIcon icon = new
ImageIcon("C:/Users/raju/Downloads/UG/Matrix/image.jpeg");
l1= new JLabel();
l1.setIcon(icon);
l1.setBounds(0,0,6000,150);
l2= new JLabel();
l2.setForeground(Color.white);
l2.setFont(new Font("Serif", Font.BOLD, 50));
l2.setBounds(100,0,1100,150);

l3= new JLabel("ENCRYPTION USING MATRICES");


l3.setFont(new Font("Serif", Font.BOLD, 30));
l3.setForeground(Color.white);
l3.setBounds(100,-30,1090,150);

l4= new JLabel("Decryption Page");


l4.setFont(new Font("Serif", Font.BOLD, 30));
l4.setBounds(450,10,300,50);

b1 = new JButton("BROWSE KEY");


b1.setBounds(35,90,170,35);
b10 = new JButton("INVERSE");
b10.setBounds(320,90,130,35);

l5=new JLabel();
l5.setFont(new Font("Serif", Font.BOLD, 18));
l5.setOpaque(true);
l5.setBackground(Color.white);
l5.setBounds(220,90,35,35);

l6=new JLabel();
l6.setFont(new Font("Serif", Font.BOLD, 18));
l6.setOpaque(true);
l6.setBackground(Color.white);
l6.setBounds(260,90,35,35);

l7=new JLabel();
l7.setFont(new Font("Serif", Font.BOLD, 18));
l7.setOpaque(true);
l7.setBackground(Color.white);
l7.setBounds(220,130,35,35);

l8=new JLabel();
l8.setFont(new Font("Serif", Font.BOLD, 18));
l8.setOpaque(true);
l8.setBackground(Color.white);
l8.setBounds(260,130,35,35);

l14=new JLabel();
l14.setFont(new Font("Serif", Font.BOLD, 18));
l14.setOpaque(true);
l14.setBackground(Color.white);
l14.setBounds(460,90,35,35);

l15=new JLabel();
l15.setFont(new Font("Serif", Font.BOLD, 18));
l15.setOpaque(true);
l15.setBackground(Color.white);
l15.setBounds(500,90,35,35);

l16=new JLabel();
l16.setFont(new Font("Serif", Font.BOLD, 18));
l16.setOpaque(true);
l16.setBackground(Color.white);
l16.setBounds(460,130,35,35);

l17=new JLabel();
l17.setFont(new Font("Serif", Font.BOLD, 18));
l17.setOpaque(true);
l17.setBackground(Color.white);
l17.setBounds(500,130,35,35);
b2 = new JButton("BROWSE TEXT");
b2.setBounds(35,180,170,35);

l9= new JLabel("");


l9.setFont(new Font("Serif", Font.BOLD, 18));
l9.setOpaque(true);
l9.setBackground(Color.white);
l9.setBounds(220,180,318,35);

b11 = new JButton("CONVERT ");


b11.setBounds(35,230,170,35);

l13= new JLabel("");


l13.setFont(new Font("Serif", Font.BOLD, 12));
l13.setOpaque(true);
l13.setBackground(Color.white);
l13.setBounds(220,230,318,35);

b3 = new JButton("Calculate");
b3.setBounds(35,280,170,35);

jt1= new JTextArea("");


jt1.setFont(new Font("Serif", Font.BOLD, 14));
jt1.setOpaque(true);
jt1.setEditable(false);
jt1.setBackground(Color.WHITE);
jt1.setBounds(220,280,100,170);

jt2= new JTextArea("");


jt2.setFont(new Font("Serif", Font.BOLD, 14));
jt2.setOpaque(true);
jt2.setEditable(false);
jt2.setBackground(Color.WHITE);
jt2.setBounds(330,280,100,170);

jt3= new JTextArea("");


jt3.setFont(new Font("Serif", Font.BOLD, 14));
jt3.setOpaque(true);
jt3.setEditable(false);
jt3.setBackground(Color.WHITE);
jt3.setBounds(440,280,100,170);

b4 = new JButton("Split");
b4.setBounds(550,130,140,35);

l10= new JLabel("");


l10.setFont(new Font("Serif", Font.BOLD, 14));
l10.setOpaque(true);
l10.setBackground(Color.WHITE);
l10.setBounds(700,130,330,35);

b5 = new JButton("Values");
b5.setFont(new Font("Serif", Font.BOLD, 18));
b5.setBounds(550,180,140,35);

l11= new JLabel("");


l11.setFont(new Font("Serif", Font.BOLD, 14));
l11.setOpaque(true);
l11.setBackground(Color.white);
l11.setBounds(700,180,330,35);

b6 = new JButton("Plain Text");


b6.setBounds(550,230,140,35);

l12= new JLabel("");


l12.setFont(new Font("Serif", Font.BOLD, 18));
l12.setOpaque(true);
l12.setBackground(Color.WHITE);
l12.setBounds(700,230,330,35);

b7 = new JButton("HOME");
b7.setBounds(550,350,120,35);

b8 = new JButton("CLOSE");
b8.setBounds(680,350,120,35);

b9 = new JButton("KEY GEN");


b9.setBounds(810,350,130,35);

b1.setFont(new Font("Serif", Font.BOLD, 18));


b2.setFont(new Font("Serif", Font.BOLD, 18));
b3.setFont(new Font("Serif", Font.BOLD, 18));
b4.setFont(new Font("Serif", Font.BOLD, 18));
b5.setFont(new Font("Serif", Font.BOLD, 18));
b6.setFont(new Font("Serif", Font.BOLD, 18));
b7.setFont(new Font("Serif", Font.BOLD, 18));
b8.setFont(new Font("Serif", Font.BOLD, 18));
b9.setFont(new Font("Serif", Font.BOLD, 18));
b10.setFont(new Font("Serif", Font.BOLD, 18));
b11.setFont(new Font("Serif", Font.BOLD, 18));

b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
b5.addActionListener(this);
b6.addActionListener(this);
b7.addActionListener(this);
b8.addActionListener(this);
b9.addActionListener(this);
b10.addActionListener(this);
b11.addActionListener(this);

p1.add(l1);
p1.add(l2);

p3.add(l3);
p2.add(l4);
p2.add(l5);
p2.add(l6);
p2.add(l7);
p2.add(l8);
p2.add(l9);
p2.add(l10);
p2.add(l11);
p2.add(l12);
p2.add(l13);
p2.add(l14);
p2.add(l15);
p2.add(l16);
p2.add(l17);

p2.add(jt1);
p2.add(jt2);
p2.add(jt3);

p2.add(b1);
p2.add(b2);
p2.add(b3);
p2.add(b4);
p2.add(b5);
p2.add(b6);
p2.add(b7);
p2.add(b8);
p2.add(b9);
p2.add(b10);
p2.add(b11);

add(p1);
add(p2);
add(p3);
setSize(1100, 700);

Dimension dim = Toolkit.getDefaultToolkit().getScreenSize();

// Determine the new location of the window


int w = this.getSize().width;
int h = this.getSize().height;
int x = (dim.width-w)/2;
int y = (dim.height-h)/2;

// Move the window


this.setLocation(x, y);

setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setVisible(true);
}

public void actionPerformed(ActionEvent ae)


{
if(ae.getSource()== b1)
{
key="";
l5.setText("");
l6.setText("");
l7.setText("");
l8.setText("");
try
{
String s="";
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new
File(System.getProperty("user.home")));
int result = fileChooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION)
{
File selectedFile = fileChooser.getSelectedFile();
s=selectedFile.getAbsolutePath();
q1=1;
}

FileReader fr=new FileReader(s);


int i;
while((i=fr.read())!=-1)
key+=(char)i;
fr.close();

String str[]=key.split("\\s+");
l5.setText(str[0]);
l6.setText(str[1]);
l7.setText(str[2]);
l8.setText(str[3]);

}
catch(Exception e1){}
}
if(ae.getSource()== b10)
{
Mat[0][0]=Integer.parseInt(l5.getText());
Mat[0][1]=Integer.parseInt(l6.getText());
Mat[1][0]=Integer.parseInt(l7.getText());
Mat[1][1]=Integer.parseInt(l8.getText());

int d=Mat[0][0]*Mat[1][1] - Mat[0][1]*Mat[1][0];

Inv[0][0]=(int)(Mat[1][1]/d);
Inv[0][1]=(int)(-Mat[0][1]/d);
Inv[1][0]=(int)(-Mat[1][0]/d);
Inv[1][1]=(int)(Mat[0][0]/d);

l14.setText(""+Inv[0][0]);
l15.setText(""+Inv[0][1]);
l16.setText(""+Inv[1][0]);
l17.setText(""+Inv[1][1]);
}
if(ae.getSource()== b2)
{
ct="";ct1="";
l9.setText("");
try
{
String s="";
JFileChooser fileChooser = new JFileChooser();
fileChooser.setCurrentDirectory(new
File(System.getProperty("user.home")));
int result = fileChooser.showOpenDialog(this);
if (result == JFileChooser.APPROVE_OPTION)
{
File selectedFile = fileChooser.getSelectedFile();
s=selectedFile.getAbsolutePath();
q1=1;
}

FileReader fr=new FileReader(s);


int i;
while((i=fr.read())!=-1)
{
ct+=(char)i+"";
ct1+=i+" ";
}
fr.close();
l9.setText(ct);
}
catch(Exception e1){}
}
if(ae.getSource()== b11)
{
l13.setText("");
l13.setText(ct1);

arr=new int[ct.length()];
int i=0;
char chArr[]=ct.toCharArray();
for(char ch:chArr)
arr[i++]=(int)ch;

}
if(ae.getSource()== b3)
{
jt1.setText("");
jt2.setText("");
jt3.setText("");
String z="";

int k=0;
Mat2=new int[arr.length/2][2];
String R1="",R2="",R3="";

for(int i=0;i<arr.length/2;i++)
{
for(int j=0;j<2;j++)
{
Mat2[i][j]=arr[k++];
}
}

m=2;n=2;p=arr.length/2;q=2;
C=new int[n][p];

//-------------------------------------------

for(int i=0;i<1;i++)
{
for(int j=0;j<p;j++)
{
for(k=0;k<2;k++)
{
R1+=(Inv[k][i]*Mat2[j][k]);
if(k % 2==0)
R1+=" + ";
}
jt1.setText(jt1.getText()+"[ "+R1+" ]\n");
R1="";
}
}

//------------------------------
for(int i=1;i<n;i++)
{
for(int j=0;j<p;j++)
{
for(k=0;k<2;k++)
{
R2+=Inv[k][i]*Mat2[j][k];
if(k % 2==0)
R2+=" + ";
}
jt2.setText(jt2.getText()+"[ "+R2+" ]\n");
R2="";
}
}
//--------------------------------
for(int i=0;i<n;i++)
{
for(int j=0;j<p;j++)
{
C[i][j]=0;
for(k=0;k<2;k++)
{
C[i][j]+=Inv[k][i]*Mat2[j][k];
}
}
}

for(int i=0;i<p;i++)
{
for(int j=0;j<n;j++)
{
R3+=C[j][i]+" ";
}
jt3.setText(jt3.getText()+"= [ "+R3+" ]\n");
R3="";
}

}
if(ae.getSource()== b4)
{
l10.setText("");
ct="";
int k=0;
for(int i=0;i<p;i++)
{
for(int j=0;j<n;j++)
{
if(k%2==0)
ct+="["+C[j][i];
else
ct+=" "+C[j][i]+"],";
k++;
}
}
l10.setText(ct+"");

}
if(ae.getSource()== b5)
{
ct="";
l11.setText("");
for(int i=0;i<p;i++)
{
for(int j=0;j<n;j++)
{
ct+=C[j][i]+" ";
}
}
l11.setText(ct+"");

}
if(ae.getSource()== b6)
{ ct="";
l12.setText("");
for(int i=0;i<p;i++)
{
for(int j=0;j<n;j++)
{
if(C[j][i]==0)
ct+=" ";
else
ct+=(char)(C[j][i]+64)+"";
}
}
l12.setText(ct+"");
}
if(ae.getSource()== b7)
{
new HomePage();
setVisible(false);
}
if(ae.getSource()== b8)
{
System.exit(0);
}
if(ae.getSource()== b9)
{
new KeyGenerationPage();
setVisible(false);
}
}

public static void main(String s[])


{
new DecryptionPage();
}
}
TESTING
6. TESTING

6.1 Introduction

Testing is the process of finding differences between the expected behaviour specified by
system models and the observed behaviour of the system. Testing is a critical role in quality
assurance and ensuring the reliability of development and these errors will be reflected in the
code so the application should be thoroughly tested and validated.

Testing is the process of finding differences between the expected behaviour specified
by system models and the observed behaviour of the system. Testing is a critical role in
quality assurance and ensuring the reliability of development and these errors will be
reflected in the code so the application should be thoroughly tested and validated.

Unit testing finds the differences between the object design model and its
corresponding components. Structural testing finds differences between the system design
model and a subset of integrated subsystems. Functional testing finds differences between the
use case model and the system.

Finally performance testing, finds differences between non-functional requirements


and actual system performance. From modelling point of view, testing is the attempt of
falsification of the system with respect to the system models. The goal of testing is to design
tests that exercise defects in the system and to reveal problems.

6.2 Different levels of testing are as follows:

6.2.1 Unit Testing:

In this test each component is tested independent of the other thus allowing parallelism in
testing activity.

6.2.2 Integration Testing:

Many tested modules are combined into subsystem. The emphasis is on testing interface
between modules. This activity can be considered to test the design.
6.2.3 System Testing:
6
This is a series of testing whose purpose 0
is to fully exercise the entire software system.
System testing verifies that all elements mesh properly and the overall system
function/performance is achieved. System testing is done using real data. The system
performance was found to be working to be as per requirements specified.

6.2.3.1 System Testing:

 System testing ensures that the complete system compiles with the functional
requirements and non-functional requirements of the system, the following are some
system testing activities.
 Functional testing finds differences between the functional between the functional
requirements and the system. This is a black box testing technique. Test cases are
divided from the use case model.
 Performance testing finds differences between the design and the system the design
goals are derived from the functional requirements.
 Pilot testing the system is installed and used by a selected set of users – users exercise
the system as if it had been permanently installed.
 Acceptance testing, I have followed benchmarks testing in a benchmarks testing the
client prepares a set of test cases represent typical conditions under which the system
operates. In our project, there are no existing benchmarks.

But, there are certain benchmarks available on the Internet regarding the minimum and
maximum time limits for generating the random Big Integer values. We have used these
to test the system. Installation testing, the system is installed in the target environment.

6.3 Testing Approaches:

There are three basic approaches to testing:

 Functional (Black box testing)


 Conditional
 Structural (White box testing)
6.3.1 White box Testing:

6 Test cases are derived to ensure that all the


This test focuses on the program control structure.
statements in the program have been executed 1at least once during testing and that all logical
conditions have been exercised.

6.4Condition testing:

Condition testing is a test case design method that exercises the logical conditions contained
in a module the condition testing focuses on testing each condition in the operation.

6.4.1 Black box Testing:

These tests are designed to validate functional requirements without regard to working of the
program. Black box testing technique focuses on the information domain of the software
deriving test cases by partitioning input and output in a manner that provides thorough test
coverage. This approach also deals with the identification of class libraries or software
packages or other application systems, which are already present so that developer can
implement the object models with a decreased burden of testing.

6.4.2 Testing Activities:

Testing a large system is a complex activity and like any complex activity. It has to be broke
into smaller activities. Thus incremental testing was performed on the project i.e.,
components and subsystems of the system were tested separately before integrating them to
form the subsystem for system testing.

6.5 Testing types:

6.5.1 Unit Testing:

Unit testing focuses on the building blocks of the software system that is the objects and
subsystems. There are three motivations behind focusing on components. First unit testing
reduces the complexity of overall test activities allowing focus on smaller units of the system,
second unit testing makes it easier to pinpoint and correct faults given that few components
are involved in the rest. Third unit testing allows parallelism in the testing activities, that is
each component are involved in the test. Third unit testing allows parallelism in the testing
activities that is each component can be tested independently of one another.

In this system each module of segment display, encryption and decryption are treated
as individual units and are tested individually

The following are some unit testing techniques.

 Equivalence testing:

It is a black box testing technique that minimizes the number of test cases. The possible
inputs are partitioned into equivalence classes and a test case is selected for each class.

 Boundary testing:

It is a special case of equivalence testing and focuses on the conditions at the boundary of the
equivalence classes. Boundary testing requires that the elements be selected from the edges of
the equivalence classes.

 Path testing:

It is a white box testing technique that identifies faults in the implementation of the
component the assumption here is that exercising all possible paths through the code at least
once. Most faults will trigger failure. This acquires knowledge of source code.

In this project, Individual units like login page, registration page are etc., tested.

 Integration Testing:

Integration testing defects faults that have not been detected. During unit testing by focusing
on small groups on components two or more components are integrated and tested and once
tests do not reveal any new faults, additional components are added to the group. This
procedure allows testing of increasing more complex parts on the system while keeping the
location of potential faults relatively small. I have used the following approach to
implements and integrated testing.

6
Top-down testing strategy unit tests the components of the top layer and then integrated the
components of the next layer down. When all components of the new layer have been tested
together, the next layer is selected. This was repeated until all layers are combined and
involved in the test.

In this project, we first perform individual testing on the modules. Later some
modules like different issues, transaction table, and transaction trimming will be integrated to
form single unit.

 Validation Testing:

The systems completely assembled as package, the interfacing have been uncovered and
corrected, and a final series of software tests are validation testing. The validation testing is
nothing but validation success when system functions in a manner that can be reasonably
expected by the customer. The system validation had done by series of Black-box test
methods.

 System Testing:

1. System testing ensures that the complete system compiles with the functional requirements
and non-functional requirements of the system, the following are some system testing
activities.

2. Functional testing finds differences between the functional between the functional
requirements and the system. This is a black box testing technique. Test cases are divided
from the use case model.

3. Performance testing finds differences between the design and the system the design goals
are derived from the functional requirements.

4. Pilot testing the system is installed and used by a selected set of users – users exercise the
system as if it had been permanently installed.

5. Acceptance testing, I have followed benchmarks testing in a benchmarks testing the client
prepares a set of test cases represent typical conditions under which the system operates. In
our project, there are no existing benchmarks. But, there are certain benchmarks available on

6
4
the Internet regarding the minimum and maximum time limits for generating the random Big
Integer values. We have used these to test the system. Installation testing, the system is
installed in the target environment.

Finally, test whether the application is able to trimming the transaction successfully
and eliminated the different issues and receipts. This involves testing all the individual
systems of the application. This is achieved through System testing.

6.6 Testing Plan:

Testing accounts for 45 - 75% of the typical project effort. It is also one of the most
commonly underestimated activities on a project. A test plan is a document that answers the
basic questions about your testing effort. It needs to be initiated during the requirements
gathering phase of your project and should evolve into a roadmap for the testing phase.

 Test Planning enables a more reliable estimate of the testing effort up front.
 It allows the project team time to consider ways to reduce the testing effort without
being under time pressure.
 Test Plan helps to identify problem areas and focuses the testing team’s attention on
the critical paths.
 Test plan reduces the probability of implementing non-tested components.
6.6.1 Test Case Report

Test Case-1 : Key Generation

Test Case Name : Key Generation Test.

Test Case Type : White Box Testing

Description Expected value Observed value Result


Sender/Receiver generates Matrix Key Values Matrix Key Values Success
“matrix Key Values” Should be Displayed should be generated
and saved

Table 6.6.1.1 Key Values testing

Test case-2 : Encryption

Test case Name : Encryption Test


Test case Type : White Box Testing

Description Expected value Observed value Result


Sender selects Cipher
Plain text is entered/ Cipher text should be
“Encryption” text
browsed. generated
button saved.

Table 6.6.1.2 Encryption testing

Test Case-3 : Decryption Test.

Test Case Name : Decryption Test.

Test Case Type : White Box Testing


Description Expected value Observed value Result
Receiver selects Browse the Cipher text . Plain text should be Success
“Decryption” generated.
button

Table 6.6.1.3 Decryption testing


7.RESULTS

7.1 Home Page

7.2 Abstract /Execution button


7.2.1: When you click on Abstract button

7.2.2 : After selecting Execution option from fig 7.2 :

7.3 : Sender Side : After selecting Encryption method from fig 3 :


 7.3.1 : Enter keys and plaintext and select encrypt for ciphertext

7.3.2 : After clicking on “save data to file” option to save cipher text in a
text file
7.3.3: Saved text file of Cipher Text

7.4: Receiver Side : After selecting Decryption method from fig 3


7.4.1 : Enter same keys and paste the cipher text from text file which is sent by
the sender
7.4.2 : Click on Decrypt it option to get the plaintext

7.5 : Conclusion:
This algorithm provides good security for the data with key matrix and inverse
key matrix with mod 27. In future works there is a scope to provide high
security to the messages by using different matrix applications.
8. REFERENCES

8.1. Research References:


[1] Generation of Key Matrix for Hill Cipher Encryption Using Classical Cipher. On Feb
1, 2017, R. Mahendran and others .Generation of Key Matrix for Hill Cipher Encryption
Using Classical Cipher .

[2] Encryption and decryption algorithm using algebraic matrix ...


by K Thiagarajan - 2018

[3]Matrix Encryption Scheme -


by P Ratha - 2015 

[4]Matrix based cryptographic procedure

[5] Using an invertible matrix as the key to realize the encryption of image matrix.


by T Yang - Sep 10, 2018
8.2. Book Reference:

1. Network Security Essentials

Stallings, Stallings William – Computers

2. Computer security: principles and practice

William Stallings, Lawrie Brown, Mick Bauer, Michael Howard

3. Network security: private communication in a public world

Charlie Kaufman, Radia Perlman, Mike Speciner

4. Network and Internetwork Security: Principles and Practice

William Stallings - Computers

5. Software Engineering Principles By Roger.S. Pressman

6. Object oriented s/w engineering By Tata MCGRAW HILL

7. Cryptography and Network security principles and practices.


Fifth William stallings.

8. Cryptography and Network security by Atul Kahate


APPINDEX
9. APPENDIX

9.1. List of Tables:

S. No Table Description Page


Number Number

1 3.1.2.1 Encryption use case Kindly Fill it

2 3.1.2.2 Key Generation use case

3 3.1.2.3 Decryption use case

4 7.1 Key Generation Testing

5 7.2 Encryption Testing

6 7.3 Decryption Testing

7
9
9.2. List of Figures:

S No Figure Description Page


Number Number
1 1.1 Security Threats

2 3.1.1 Sender Actor


3 3.1.2 Receiver Actor
4 3.2 Use Case Diagram

5 3.2.1.1 Sequence Diagram for Sender

6 3.2.1.2 Sequence Diagram for


Receiver
7 3.3.1.1 State Chart Diagram for sender

8 3.3.1.2 State Chart Diagram for Receiver

9 4.2.1 Example

10 4.2.2 Encryption

11 4.2.3 Decryption

12 7.1.1 Home Page

13 7.1.2 Main Page

14 7.1.4 Key Generation

15 7.15 Encryption

16 7.16 Decryption

You might also like