Professional Documents
Culture Documents
Project Report Final
Project Report Final
LEVEL SECURITY
PROJECT REPORT
Submitted by
V.ARAVINDAN (113115205009)
B.INDRAJITH (113115205023)
Of
BACHELOR OF TECHNOLOGY
in
INFORMATION TECHNOLOGY
ENGINEERING COLLEGE
APRIL 2019
BONAFIDE CERTIFICATE
Certified that this project report “ENHANCED NETWORK SECURITY USING THREE
LEVEL SECURITY” is the bonafide work of V.ARAVINDAN (113114205009), G.SURIYA
PRAKASH (113114205065), B.INDRAJITH (113114205023) who carried out the
project work under my supervision certificate further, that to the best of my
knowledge, the work reported here is does not form part of any other project report or
dissertation on the basis of which degree or award was conferred on an earlier
occasion of this or any other candidate.
SIGNATURE SIGNATURE
ii
CERTIFICATE OF EVALUATION
Semester : VIII
[113115205023]
The report of this project work submitted by the above students in partial
fulfillment for the award of Degree of Bachelor of Technology in Information
Technology of Anna University was evaluated and confirmed to be the report of
work done by the above student. This project report was submitted for the viva-
voce held on at Vel Tech Multi Tech Dr.Rangarajan
Dr.Sakunthala Engineering College.
iii
ACKNOWLEDGEMENT
We wish to express our sincere thanks to almighty and the people who extended
their help during the course of our work.
We are greatly and profoundly thankful to our honorable Chairman, Col. Prof.
Vel. Shri Dr.R.Rangarajan B.E.(ELEC), B.E.(MECH), M.S.(AUTO), D.Sc., & Vice
Chairman, Dr. Sakunthala Rangarajan MBBS., for facilitating us with this
opportunity.
Our special thanks to our cherishable Vice- President Mr.K.V.D. Kishore Kumar
B.E., M.B.A., for his attention towards students community.
We would like to express our special thanks to our Head of the Department
Mr.R.Prabu, M.Tech., Department of Information Technology Engineering and
our project supervisor Dr.M.Rajesh Khanna, B.Tech, M.E, Ph.D., for their
moral support by taking keen interest on our project work and guided us all along,
till the completion of our project work.
ABSTRACT ix
LIST OF ABBREVIATIONS x
1. INTRODUCTION 1
1.1 OVERVIEW 1
1.2 OBJECTIVE 2
2. SYSTEM ANALYSIS 2
3. SYSTEM IMPLEMENTATION 10
5. SYSTEM DESIGN 15
6. CONCLUSION 23
7. FUTURE ENHANCEMENT
24
APPENDIX I (SOURCE CODE) 25
REFERENCES 71
LIST OF FIGURES
vii
LIST OF TABLES
viii
LIST OF ABBREVIATIONS
ABBREVIATIONS EXPANSION
RSA Rivest-Shamir-Adlmen
MR Magic Rectangle
ix
ABSTRACT
x
CHAPTER 1
INTRODUCTION
1.1 OVERVIEW
1
mathematical techniques related to aspects of information security such as
confidentiality, Data Integrity, user validation, and data source authentication.
Symmetric and Asymmetric keys are the two categories of cryptography
algorithms. In Symmetric keys encryption or secret key encryption, for
encryption and decryption of data a single key is used. The secret key is known
only to the sender and receiver of a message who can apply the same key for
encryption and decryption process. The main challenge is getting the sender
and receiver to agree on the secret key without anyone else finding out. The
key should be distributed before transmission between entities. The concept of
public- key cryptography was brought into use during 1976 by Whitfield
Diffie and Martin Hellman to overcome the key management issues. Two
separate keys are used in Public-key cryptography. The first key is acting as a
secret key and the remaining one is public. Even though these keys are
different, the two parts of the key pair are mathematically linked. The
algorithms used for public key cryptography are based on mathematical
relationships such as integer factorization an discrete logarithms.
1.2 OBJECTIVE
3
CHAPTER 2
SYSTEM ANALYSIS
YEAR : 2017
4
TITLE : Public Key Cryptosystem
Add-on Security Level for Public Key Cryptosystem Magic using Rectangle
YEAR : 2015
5
TITLE : N-Prime RSA Security
A Research on Enhancing Public Key Cryptography
AUTHOR : Alaa Hussein Al-Hamami and Ibrahem abdallah aldariseh,
“Enhanced Method of RSA cryptosystem Algorithm”, Kuala Lampur
YEAR : 2013
DESCRIPTION : This work prohibits any intruders from obtaining the plain
text in a readable form. The security aspect is enhanced as there is no repetition
of values in Magic rectangle. There are several parameters used to increase the
time complexity for the construction of magic rectangle such as seed value,
column sum, Minstart and Maxstart values. Even if the intruders found the
initial values of MR, it is very difficult to trace the row/column. It plays a vital
role in increasing the randomness and security of the algorithm. And the use of
RSA have the issue that the prime numbers used should be more than 100. So
have taken N-prime RSA so that more than two prime numbers will be used and
that can make the prediction of prime numbers somewhat easier. And the other
thing is that two same character in plain text do not have same cipher text. One
of the issues in the proposed work is additional time needed for the construction
of Magic rectangle initially.
Each number has 100 digits and “n” has 300 digits as before.
6
2.2 EXISTING SYSTEM
Maintaining a database for this problem also has lots of problem with it.
Two large prime numbers are used
RSA Cryptosystem is used to generate keys
Plaintext is encrypted with respect to ASCII values
Cipher text is decrypted by RSA
Repeated characters will have repeated ciphers.
2.2.1 DRAWBACKS
Prime numbers should be carefully chosen such that they are not
7
2.3.1 Construction of Magic Rectangle
The magic square concept forms the basis for magic Rectangle. A magic
square of order n is an arrangement of integers in an nxn matrix such that the
sums of all the elements in every row, column are equal. In addition, the sums
of all elements along the two main diagonals are also equal. The magic constant
of a magic square depends only on n and has the value
M (n) = n (n2 + 1) / 2
Magic square can be classified into three types: odd, doubly even (n divisible
by four), singly even (n is even and not divisible by four) .
This methodology is implemented in Java. The time taken for encryption and
decryption of various size of file message are measured. As an illustration, the
following magic rectangles are generated with row sum as 4629 and column
sum as 3086. In this experiment, the seed value is 0010. The first, second and
the last Magic rectangles are unchanged as the respective seed value is ‘0’. The
column values are shifted circularly in the third Magic rectangle since the seed
value for the same is ‘1’.
8
2.3.3 ADVANTAGES
It is observed that whenever the file size is increases, the total time for
encryption and decryption process will also increases. The limitations in the
proposed work it that it needs additional time to construct magic rectangle
initially. However, encryption and decryption process does not call for any
addition time. The randomness of the value of magic rectangle enhances the
security of the cipher text. In the existing concept of ASCII, the cipher text
values are repeated whenever the same characters are repeated in the plain text.
In the proposed magic rectangle, different values are applied in the cipher text
for each occurrence of same character in plain text. It enhances of the security
of the cipher text. Instead of single ASCII table, 12 tables with different set of
values are used. It is more complicated to identify the value of MR assigned
into the plain text by any intruders.
It is summarized that,
2. Increases the randomness of the cipher text value even though the
characters are repeated.
3. Can generate rectangles from any values with equal row sums and
column sums.
5. Increases the complexity to derive the plain text from the cipher text by
any intruders.
9
CHAPTER 3
SYSTEM IMPLEMENTATION
Hardware Specifications
RAM 4 GB
Software Specifications
10
CHAPTER 4
SYSTEM MODULES
11
4.1.1 MODULE DESCRIPTION
MRGA ALGORITHM
Step-1: Get the column sum for 32*48 from the matrix.
Step-2: Obtain column sum for 4*6 from given 32*48 column sum.
12
4.1.1.2 Mapping
Input ASCII value are mapped with numerals in quadrants.
The most well known algorithm design strategies are to divide instance
of problem into two or more small instances such as Solving smaller
instances recursively Obtaining solution to original instance combining
these solution In magic rectangle , column sum is fixed as 16x24 . The
existing column sum is divided by two and then apply in 8x12. Further
the column sum is divided by two and apply in 4x6 matrix. This
approach is adapted from divide and conquer strategy.
4.1.1.3 Encryption
The mapped numeral is sent to 3-prime RSA to obtain
cipher. The column sum is taken as even value then it matches exactly
in magic rectangle.In case of, the column sum is taken as odd value then
the column sum is reduced by one because of fractional value. For
example, the initial column sum is taken as a odd value such as 12345.
The column sum generated by the rectangle is 12344.
4.1.1.4 Decryption
The cipher is decrypted to get numerals. The given
message is “HELLO”. First, each and every character of the message is
converted to the numerical value by using magic rectangle. The ASCII
value of ‘H’,’E’,’L’,’O’ is 72,69,76 and 76 respectively. To encrypt ‘H’,
the value of the 72 position in the first MR 16x24 is taken, then the
value of the second and third characters are also taken from the same
matrix. The character ‘L’ is repeated twice consecutively in the plain
text. The first occurrence of ‘L’ value is taken from one matrix of order
16*24 and the second occurrence uses another matrix of the same size.
13
4.1.1.5 3-Prime RSA Formation
Step-2: Find n such that n = p*q*s. n will be used as the modulus for
both the public and private keys.
Step-4: Choose an e such that 1 < e < ¥ (n), and such that e and ¥ (n)
share no divisors other than 1 (e and ¥ (n) are relatively prime). e is
kept as the public key exponent.
14
CHAPTER 5
SYSTEM DESIGN
15
5.1.1 USE CASE DIAGRAM
DESCRIPTION
The user receives the ascii message before starting the process. Then
magic rectangle is generated based on some conditions. Then the ascii message
or ascii values are mapped to the MRG values and they are encrypted. The
encrypted key is passed to the receiver in order to decrypt the same message.
The decryption process is performed similar to encryption process and hence the
plaintext is obtained.
16
5.1.2 SEQUENCE DIAGRAM
DESCRIPTION
The ascii message is mapped with MRG values. The resultant would be
randomized input, which is further used to generate key. The encrypted cipher is
sent to the receiver for decryption process. The decryption process is performed
similar to encryption process and hence the plaintext is obtained. After all the
process acknowledgement will be sent to the user.
17
5.1.3 ACTIVITY DIAGRAM
DESCRIPTION
18
5.1.4 CLASS DIAGRAM
DESCRIPTION
19
5.1.5 COLLABORATION DIAGRAM
DESCRIPTION
It is similar to class diagram. All the properties, objects, etc used by the
classes are also used by the collaboration diagram. It is similar to interaction
diagram. There are several classes such as 3-prime RSA, Receiver, Mapping,
Sender, and finally MRGA. The process is performed based on step by step
manner.
20
5.1.7 DEPLOYMENT DIAGRAM
DESCRIPTION
The entire system is deployed by this deployment diagram. The tools and
databases are used to represent the outside layer of the system. The java runtime
environment is used and all the data contents are fetched from databases. The
operating system is used in order to run the softwares related to the system.
21
5.1.8 PACKAGE DIAGRAM
DESCRIPTION
22
CHAPTER 6
CONCLUSION
23
CHAPTER 7
FUTURE ENHANCEMENT
The order of magic rectangle can be increased from 32*48 to 64*96. The
randomness is increased enormously but the time taken is very high. Chosen
prime number should not be much higher and it should not be much lower as
both are prone to attacks. The improvement in choosing the prime number
and reducing the time for matrix generation and mapping needs to be done.
24
APPENDIX-I
SOURCE CODE
MRGAlgorithm.java
package mrgalgorithm;
import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;
import java.lang.*;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Scanner;
import javax.swing.JOptionPane;
25
import javax.swing.JFrame;
String input;
new MRGAlgorithm().start();
*******************");
compute4Into6RowSum(_4Into6colSum);
generateMatrix(pivot);
int count = 4;
27
count += i % 2 != 0 ? 32 : 16;
_4Into6Matrixes.add(_4Into6);
display(_4Into6);
if (i % 4 == 0) {
combineMatrix(_4Into6Matrixes.get(0), _4Into6Matrixes.get(1),
_4Into6Matrixes.get(2), _4Into6Matrixes.get(3));
display(_8Into12);
_8Into12Matrixes.add(_8Into12);
_4Into6Matrixes.removeAll(_4Into6Matrixes);
if (i % 16 == 0) {
28
final Integer[][] _16Into24 =
combineMatrix(_8Into12Matrixes.get(0), _8Into12Matrixes.get(1),
_8Into12Matrixes.get(2), _8Into12Matrixes.get(3));
display(_16Into24);
_16Into24Matrixes.add(_16Into24);
_8Into12Matrixes.removeAll(_8Into12Matrixes);
_16Into24Matrixes.get(1), _16Into24Matrixes.get(2),
_16Into24Matrixes.get(3));
display(_32Into48);
System.out.println();
encrypt");
29
//JOptionPane.showInputDialog(input);
JOptionPane.showMessageDialog(frame, input);
doEncryption(map, input);
input) {
int count;
message:\n");
System.out.println(quadrants[i]);
bigIntegerArray[i] = BigInteger.valueOf(quadrants[i]);
eValue = rsa.RSAencrypt(bigIntegerArray);
System.out.println("\t" + eValue[i]);
// JOptionPane.showMessageDialog(null,"Encrypted cipher:
"+"\n"+eValue[i]);
31
}
dValue = rsa.RSAdecrypt(eValue);
// rsa.RSAdecrypt(eValue);
System.out.print("\t" + dValue[i]);
int count = 1;
while (temp.contains(c.toString())) {
32
temp = temp.substring(0, temp.lastIndexOf(c));
count++;
return count;
return colSum / 8;
minStart) {
33
mr[0][0] = maxStart;
mr[0][1] = minStart + 2;
mr[0][2] = minStart + 4;
mr[0][3] = maxStart - 6;
mr[1][0] = minStart + 8;
34
mr[2][3] = maxStart - 8;
mr[3][0] = minStart + 6;
mr[3][1] = maxStart - 4;
mr[3][2] = maxStart - 2;
mr[3][3] = minStart;
int m = p.length;
int n = p[0].length;
35
final Integer[][] matrix = new Integer[length][length + p.length];
buildfinalMatrix(0, 0, m, n, p, matrix);
buildfinalMatrix(0, n, m, n + n, q, matrix);
buildfinalMatrix(m, 0, m + m, n, r, matrix);
buildfinalMatrix(m, n, m + m, n + n, s, matrix);
return matrix;
private void buildfinalMatrix(int startM, int startN, int endM, int endN,
finalMatrix[i][j] = subMatrix[x][y];
36
private void display(Integer matrix[][]) {
System.out.print(matrix[i][j] + "\t");
System.out.println();
finalmatrix[][]) {
int p = 0, q = 4, count = 0;
Map < Integer, Integer[] > map = new HashMap < Integer, Integer[]
> ();
map.put(1, _1dquad1);
map.put(2, _1dquad2);
map.put(3, _1dquad3);
map.put(4, _1dquad4);
38
map.put(5, _1dquad5);
map.put(6, _1dquad6);
map.put(7, _1dquad7);
map.put(8, _1dquad8);
map.put(9, _1dquad9);
map.put(10, _1dquad10);
map.put(11, _1dquad11);
map.put(12, _1dquad12);
39
final Integer[][] quadrant_8 = new Integer[32][4];
final List < Integer[][] > quadrant = new ArrayList < Integer[][] > ();
count = 0;
if (k == 1) {
quadrant_1[m][count] = finalmatrix[m][l];
} else if (k == 2) {
quadrant_2[m][count] = finalmatrix[m][l];
40
} else if (k == 3) {
quadrant_3[m][count] = finalmatrix[m][l];
} else if (k == 4) {
quadrant_4[m][count] = finalmatrix[m][l];
} else if (k == 5) {
quadrant_5[m][count] = finalmatrix[m][l];
} else if (k == 6) {
quadrant_6[m][count] = finalmatrix[m][l];
} else if (k == 7) {
quadrant_7[m][count] = finalmatrix[m][l];
} else if (k == 8) {
quadrant_8[m][count] = finalmatrix[m][l];
} else if (k == 9) {
quadrant_9[m][count] = finalmatrix[m][l];
} else if (k == 10) {
41
quadrant_10[m][count] = finalmatrix[m][l];
} else if (k == 11) {
quadrant_11[m][count] = finalmatrix[m][l];
} else if (k == 12) {
quadrant_12[m][count] = finalmatrix[m][l];
count++;
p = p + 4;
q = q + 4;
quadrant.add(quadrant_1);
42
quadrant.add(quadrant_2);
quadrant.add(quadrant_3);
quadrant.add(quadrant_4);
quadrant.add(quadrant_5);
quadrant.add(quadrant_6);
quadrant.add(quadrant_7);
quadrant.add(quadrant_8);
quadrant.add(quadrant_9);
quadrant.add(quadrant_10);
quadrant.add(quadrant_11);
quadrant.add(quadrant_12);
int b = 0;
43
for (int j = 0; j < 4; j++) {
_1dquad1[b] = quadrant_1[i][j];
b++;
display_quadrants(quadrant_1);
display_one_d(_1dquad1);
b = 0;
_1dquad2[b] = quadrant_2[i][j];
b++;
44
display_quadrants(quadrant_2);
display_one_d(_1dquad2);
b = 0;
_1dquad3[b] = quadrant_3[i][j];
b++;
display_quadrants(quadrant_3);
display_one_d(_1dquad3);
b = 0;
45
for (int j = 0; j < 4; j++) {
_1dquad4[b] = quadrant_4[i][j];
b++;
display_quadrants(quadrant_4);
display_one_d(_1dquad4);
b = 0;
_1dquad5[b] = quadrant_5[i][j];
b++;
46
display_quadrants(quadrant_5);
display_one_d(_1dquad5);
b = 0;
_1dquad6[b] = quadrant_6[i][j];
b++;
display_quadrants(quadrant_6);
display_one_d(_1dquad6);
b = 0;
47
for (int j = 0; j < 4; j++) {
_1dquad7[b] = quadrant_7[i][j];
b++;
display_quadrants(quadrant_7);
display_one_d(_1dquad7);
b = 0;
_1dquad8[b] = quadrant_8[i][j];
b++;
48
display_quadrants(quadrant_8);
display_one_d(_1dquad8);
b = 0;
_1dquad9[b] = quadrant_9[i][j];
b++;
display_quadrants(quadrant_9);
display_one_d(_1dquad9);
b = 0;
49
for (int j = 0; j < 4; j++) {
_1dquad10[b] = quadrant_10[i][j];
b++;
display_quadrants(quadrant_10);
display_one_d(_1dquad10);
b = 0;
_1dquad11[b] = quadrant_11[i][j];
b++;
50
display_quadrants(quadrant_11);
display_one_d(_1dquad11);
b = 0;
_1dquad12[b] = quadrant_12[i][j];
b++;
display_quadrants(quadrant_12);
display_one_d(_1dquad12);
return map;
51
private void display_quadrants(Integer sub_quads[][]) {
System.out.print("\n ");
System.out.print(sub_quads[i][j] + "\t");
System.out.print("\n");
System.out.print("\t" + sub_quads[i]);
if (i % 32 == 0 && i != 0) {
52
System.out.print("\n");
RSA.java
package mrgalgorithm;
import java.math.BigInteger;
import java.util.Random;
import java.io.*;
import java.io.*;
import java.util.*;
import java.sql.*;
import javax.swing.*;
/**
*/
int primeSize;
53
/**
*/
BigInteger p, q, s;
/**
* Modulus N.
*/
BigInteger N;
/**
*r=(p-1)*(q-1)
*/
BigInteger r;
/**
*/
BigInteger E, D;
/**
String publicKey;
String privateKey;
String randomNumber;
BigInteger[] ciphertext;
54
int m[] = new int[1000];
this.primeSize = primeSize;
generatePrimeNumbers();
generatePublicPrivateKeys();
publicKey = publicKeyB.toString();
privateKey = privateKeyB.toString();
randomNumber = randomNumberB.toString();
//Encrypt data
55
//inputMessage=JOptionPane.showInputDialog(null,"Enter message
to encrypt");
//encryptedData=RSAencrypt(inputMessage);
//System.out.println("Encrypted message"+encryptedData);
//JOptionPane.showMessageDialog(null,"Encrypted Data
"+"\n"+encryptedData);
//Decrypt data
//decryptedMessage=RSAdecrypt();
//JOptionPane.showMessageDialog(null,"Decrypted Data
"+"\n"+decryptedMessage);
/**
*/
do {
do {
/**
*/
N = p.multiply(q);
N = N.multiply(s);
r = p.subtract(BigInteger.valueOf(1));
r = r.multiply(q.subtract(BigInteger.valueOf(1))); //(p-1)(q-1)
do {
D = E.modInverse(r);
57
public BigInteger getp() {
return (p);
return (q);
return (r);
return (N);
return (E);
return (D);
/** Encryption */
E = new BigInteger(publicKey);
58
N = new BigInteger(randomNumber);
try {
ciphertext = encrypt(quadrants);
} catch (Exception e) {
System.out.println(e);
return ciphertext;
int i;
return (encrypted);
D = new BigInteger(privateKey);
N = new BigInteger(randomNumber);
59
//int k1= 0;
//while (st.hasMoreTokens()) {
//k1++;
//}
//iv=decrypted[i].intValue() ;
//byteArray[i] = iv.byteValue();
//}
//try {
//}
60
//catch (Exception e) {
//System.out.println(e);
//}
return (decrypted);
/**
*/
61
APPENDIX – 2
SNAPSHOTS
INPUTS
62
GENERATING 4*6 MATRIX
63
GENERATING 8*12 MATRIX
64
GENERATING 16*24 MATRIX
65
GENERATING 32*48 MATRIX
66
SPLITTING INTO QUADRANTS
67
INPUT PLAIN TEXT
68
MRGA MAPPING AND 3-PRIME RSA KEY GENERATION
69
ENCRYPTION
70
REFERENCES
[2]. Gopinath Ganapathy, and K.Mani , “ Add-On Security Model for public
key Cryptosystem Based on Magic Square Implementation”, ISBN 978-988-
17012-6-8, Proceedings of the world congress on Engineering and Computer
Science 2009 Vol I, San Fransisco, USA
[4]. Ravi Shankar Dhakar, Amit Kumar Gupta, Prashant Sharma ”Modified
RSA Encryption Algorithm(MREA)”- 978-0-7695-46407/12, IEEE2012.
[6]. Sami A Nagar and Saad Alshamma, “High speed implementation of RSA
Algorithm with modified Keys exchange”, SETIT2012,IEEE
[7]. Adam Rogers, and Peter Loly ,”The inertial properties of Squares and
Cubes”, Nov-2004, pp.1-3.
[8]. en.wikipedia.org/wiki/Golden_rectangle
[9]. Omotheinwa T.O, Ramon S.O., “ Fibonacci Numbers and Golden Ratio
in Mathematics and Science”, International Journal of Computer and Information
Technology (ISSN”2279-0764) Volume 03-Issue 04, July 2013
71
[10]. Mohammad Zaidul Karim and Nargis Akter, “ Optimum Partition
Parameter of Divide-And-Conquer Algorithm for solving closest-Pair Problem”,
International Journal of Computer Science & Information Technology (IJCSIT)
Vol 3, No 5,Oct 2011.
[11]. B.Schenier. “Applied Cryptography”, John Wiley & Sons Inc, New
York, Second Edition, 1996.
72