Project Report For Advanced Encryption System - Complted
Project Report For Advanced Encryption System - Complted
Encryption System
By
SHAKKIRA.K
Enrolment no. 126596130
Under the Guidance of
Dr. KABEER
COURSE COORDINATOR
AL FAROOK, FROOK COLLEGE, KOZHIKODE
Submitted to the school of Computer and Information Sciences
In partial fulfillment of the requirements for the degree of
Encryption System
126596130
Study Center
Regional Center
Vadakara,
shakkira.shaki@gmail.com
Telephone No
9567398299
RCCode
83
SHAKKIRA.K,
KACHAKKARAN
(H),KIZHAKKUMPARAMBA,MALAPPURAM (DST)
2. Title of the Project:
Encryption System
3. Name and Address of the counselor
:
Dr. V.KABEER
Signature of the
counsellor
Date:
Date:
Encryption System
CERTIFICATE
This is to certify that the project report entitled Encryption
System submitted to Indira Gandhi National Open University in
partial fulfillment of the requirement for the award of the degree of
MASTER OF COMPUTER APPLICATION (MCA) is an original
work carried out by Miss. SHAKKIRA.Kenrolment No 126596130
under my guidance. The matter embodied in this project is authentic and
is genuine work done by the student and has not been submitted to
whether to this university or to any other university /institute fulfillment
of the requirement of any course of study.
Signature
of
the
Counsellor
Date:
Date:
Student:
Address of thecounsellor:
SHAKKIRA.K
KACHAKKARAN(HOUSE)
PANDALLUR (PO),KIZHAKKUMPARAMBA
MALAPPURAM
Enrolment No:126596130
Encryption System
Tasks and
Member
Responsibilities
1. Shakkira
Data manager
Report writing
2. Subeesh.U.P
Programmer
Program development
3. Libin
Coordinator
4. Vinaya
Auditor
1. Shakkira
2. Subeesh
3. Lipin
4. Vinaya
Date
Encryption System
ABSTRACT
The title of our project is ENCRYPTION SYSTEM. This
project encrypts and decrypts the files by using Advanced Encryption
Standard (AES) algorithm. Our aim is to develop the software named
ENCRYPTION SYSTEM that encrypts and decrypts the files by using
Advanced Encryption Standard (AES) algorithm. Encryption and
Decryption is strong file encryption software for personal and
professional security. It protects privacy of our documents and sensitive
files by encrypting them using Advanced Encryption Standard (AES)
algorithm to provide high protection against unauthorized data access.
In todays world the networking plays a very
important role in our life. Most of the activities occur
through the network. For the safe and secured exchange
of information, we need to have security. The encryption
has very wide applications for securing data.Encryption
refers to set of algorithms, which are used to convert the
documents and any files to code or the unreadable form of
files, and provides privacy. To decrypt the file to receiver
uses the key for the encrypted files.
This project work helps you to understand what cryptography is
all about and the procedures used to achieve this aim, it explains the
design and implementation of computer security: data encryption and
decryption and AES algorithm. The programming language used in the
development of this project is java.The Java platform refers to a
group of software products from Sun Microsystems. The
platform is used to develop and run Java programs. The
platform includes the execution engine (called a Java
Virtual Machine) that allows Java programs to do the
same thing on different computer systems.
Encryption System
ACKNOWLEDGEMENT
With all praises to the almighty God whose abundant Grace and
Mercies enabled me to complete this project. I would like to express my
profound gratitude to all the people who have inspired and motivated
me to make this project a success.
I dedicate this project to my parents for the inspiration, strength
and blessing endowed upon me.
I would like to express my sincere thanks to Dr.V.Kabeer Course
Coordinator for his invaluable suggestion given at every step. I think
him for all his encouragement, inspiring, guidance, advice and
suggestion throughout my project work.
Thanks are also due to all my faculties and friends, in my
college for their timely help during the tenure of the project. Once again
I think one and all who have helped me directly and indirectly in the
successful completion of the project work.
Thanking
you
Encryption System
TABLE OF CONTENTS
TITLE
PAGE
Abstract
Acknowledgement
Table of content
CHAPTER 1: INTRODUCTION
1.1 Background
1.2 Objectives
1.3 Purpose, Scope & Applicability
10
11
12
1.3.1 Purpose
1.3.2 Scope
1.3.3 Applicability
1.4 Achievements
1.5 Organization of Report
14
15
16
Encryption System
40
Encryption System
LIST OF FIGURES
Figure 1: Conceptual Models
35
39
Figure 3: Encryption
42
Figure 4: Decryption
43
44
Encryption System
CHAPTER 1: INTRODUCTION
1.1 Background
As the computers and networked systems increases in the world of
today, the need for increased data security also becomes necessary and
important. The development of computer network system has exposed
many networks to various kinds of authentication threats and with these
exposures; one can see that the need for increased network and data
security is vital and important in every organization.
The security may include identification, authentication and
authorization of user in a network environment. Some cryptography
technique may be used to solve all these problems.
Cryptography technique has reduced unauthorized access of data.
Encrypted data may be stored in to file. Then authorized person are
supposed to decrypt this data with the help of some keys.
1.2 Objectives
The main objective of our project is to encrypt or decrypt the any
files for personal and professional security. Encryption and Decryption
protects privacy of our documents and sensitive files by encrypting
them using Advanced Encryption Standard (AES) algorithm to provide
high protection against unauthorized data access.
In todays world the networking plays a very
important role in our life. Most of the activities occur
through the network. For the safe and secured exchange
10
Encryption System
security.
We can prevent information loss when system crashes occurred.
The information will be recovered from the backup data.
Enhancing efficiency of data retrieval.
File Sending.
Better accuracy and improved consistency.
Help facility will be provided.
11
Encryption System
Each step is clearly stated and user will not face any
ambiguity in using the software.
The software provides clarity in its functionality even to
nave users.
No complexity is involved.
12
Encryption System
1.3.3 Applicability
Encryption and Decryption Application Components
provide
the
integration
of
software
or
hardware
1.4Achievements
Goal of Encryption
Conveys
transit.
Changes readable file into something that cannot
be read.
Discourages anyone from reading or copying the
files.
Encryption algorithms are considered secure if the
confidentiality
to
messages
while
in
Encryption System
Security
does
not
depend
on
secrecy,
length.
If this factor is true, then the only possible attack
against the algorithm is a brute force attack.
14
Encryption System
Encryption System
purpose,
concurrent,
oriented computer
class-based,
programming
language
objectthat
is
Encryption System
Target
Our target is the common man who wants to interact client and
server, whether it is through messages, documents and any files etc.
Through network via file sending sensitive messages or documents over
the network is very dangerous.So, our project helps him to interact in a
safe and secure manner in order to keep their private information
confidential.
Target Users
The main target users of our project are the people who transmit
confidential information network via file sending sensitive messages or
documentst hrough the client server interaction.
Scope and Key Elements
The scope of our project is presently specific. Both the sender and
the receiver must have this software installed on their systems to
encrypt/decrypt and compress/decompress the files transmitted between
them. The system provides the security and integrity of data or
information.
It will provide a more clear and non-ambiguous description
of the functions.
The system is highly user friendly.
It uses secret keys for encryption and decryption.
The software provides clarity in its functionality even to
nave users.
Analysis is the detailed study of the various operations
performed by a system and their relationships within and outside the
system. System analysis is an approach to study the system and find a
solution. It provides as frame work for visualizing the organizational
facts that operate on a system. The aspect of analysis is defining the
boundaries of the system and determining whether or not a candidate
system should consider.
17
Encryption System
During the analysis the data are collected from the available
resources for analysis. Information from the existing system, dataflow
diagram, on site observations and interviews are the various tools used
during the analysis to collect information. The natural problem solving
process consists of the following steps.
1. The identification of the problem situation that needs to be
2.
3.
4.
5.
solved.
Defining the problem.
Defining the desired outcome.
Provide possible alternative solution.
Identifies and selects the best one among them.
Identification of Need
This network project aims to achieve storing of most important
information in encrypted form. They rely on a secret piece of
information called the key. Hackers objective is to obtain the key from
the communication. The various scope which cryptographic algorithms
guarantees certain level of security, confidentiality and integrity of data.
There is great need for encryption, authentication
techniques, user identification and passwords. These will
all protect your computer from damage or from hackers
(people who gain access to your computer and then
illegally steal your data.).
Encryption is only one method which can be used when
you want to be able to protect your computer from harm
and hackers. Encryption is when you put a secret key or
password on your work that will then transform your data
into an unreadable file if you don't have the secret key
and password. It is best to encrypt something that you
will transfer over the network because it has high
18
Encryption System
Behavioral Feasibility
Economic Feasibility
Technical feasibility
Operational Feasibility
19
Encryption System
Behavioral Feasibility
An estimate should be made of how strong a reaction the
users is likely to have toward the development of a new system. It is
common that the new system requires special effort to educate, sell
and train the users. But in the case of the Virtual Drive, anyone who
has a basic knowledge of computer can easily work with this system
so the users do not feel any difficult with this, so they can accept the
system without any willingness.
Technical Feasibility
Technical feasibility revolves around the technical support of the
project. The main infrastructure of the project included the project labs
in the college campus. The systems there were easily able to absorb the
new software being installed. The project thus was technically feasible.
The equipment and the software produced no problem. The projects
technical requirements were met. The project could be made to work
correctly, fulfilling its task, with the existing software and personnel.
Economic Feasibility
The project developed, Encryption and Decryption was within
budget and producing the desired results. The labor or the human ware
consisted of the four group members of our project. The output
consisted of getting the desired results. Thus with the consideration of
the inputs, the outputs were achieved successfully. The project was
within limit. The inputs didnt overdo the outputs.
Operational Feasibility
Operational Feasibility aims to determine the impact of the
system on the users. The system developing has an influence on its
20
Encryption System
users. Our system Advanced Encryption System was new for them
but it was simple enough for any nave person to understand. The
evolution of this new system required no special training for the users.
Encryption and Decryption was found to be feasible in this regard. The
system developed would be user friendly and no complexities would be
involved in its functionalities.
21
Encryption System
Proposed System
The proposed system is quiet simple to use. It is not complex in
its functionalities. It is easy for a nave user to use it.
If you want to send sensitive information via network, simply paste the
encrypted file
. All the recipient has to do is to decrypt your file.Encryption and
Decryption works with any information and files. Just select what you
want to encrypt, and Encryption and Decryption software helps you
keep documents, private information and files in a confidential way. The
proposed system will help the user to reduce consuming time. The
system requires very low system resources and the system will work
only in network connections.
Benefits
After each
Encryption System
reports were also even when large amount of data was used.
Security Requirements
Web application are available via network access, it is a difficult.
If not possible, to limit the population of the end-user who may access
23
Encryption System
behavior sets, and then apply, test and validate those behaviors. It also
shows how to create and build a stencil to hold the shapes.
Encryption System
Sl.No
1
Duration
Sep First 1 week
Activity
Problem Understanding
Software Requirement
Requirement Analysis
OCt
week
Structured Analysis
Input Design
Output Design
Coding
9
10
11
Nov
Second
1 Data Collection
week
Nov
Module testing
Third 1 System testing
25
Encryption System
12
week
Implementation
TASKS
WEEK
1
WEE
K2
REQUIREM
ENT
GATHERING
DESIGN
TEST CASES
CODING
26
WEEK
3
WEE
K4
WEEK
5
WEEK
6
Encryption System
QUALITY
ASSURANC
E
TESTING
BUILD
1GHz above
256 MB above
Ethernet
104 Keys/ touch typing
HUB/SWITCH
for
connecting
network
Software requirements
1. OS
27
Encryption System
About Java
Java is a high-level, third generation programming language,
like C, FORTRAN, Smalltalk, Perl, and many others. You can use Java
to write computer applications that play games, store data or do any of
the thousands of other things computer software can do. Compared to
other programming languages, Java is most similar to C. However
although Java shares much of C's syntax, it is not C. Knowing how to
program in C or, better yet, C++, will certainly help you to learn Java
more quickly, but you don't need to know C to learn Java. A Java
compiler won't compile C code, and most large C programs need to be
changed substantially before they can become Java programs. What's
most special about Java in relation to other programming languages is
that it lets you write special programs called applets that can be
downloaded from the Internet and played safely within a web browser.
Java language is called as an Object-Oriented Programming language
28
Encryption System
29
Encryption System
Object Oriented Design:Object oriented design (OOD) transforms the conceptual model
produced in object oriented analysis to take account of the constraints
imposed by the chosen architecture and any non- functional
technological or environmental constraints, such as transaction
throughout,
response
time,
run
time
platform,
development,
Object Oriented Programming:It is a programming Para diagram that uses object data
structure consisting of data fields and method together with their
interaction to design applications and computer programs. Programming
techniques may include features such as data abstraction, modularity,
polymorphism, and inheritance.
An object is actually a discrete bundle of functions and procedures, all
relating to a particular real world concept such as a bank account holder
or hockey player in a computer game. Other piece of software can
access the object only by calling its functions and procedures that have
been allowed to be called by outsiders. A large no: of software engineers
agree that isolating objects in this way makes their software easier to
manage and keep track of.
The technology focuses on data rather than process, with
programs composed of self- sufficient modules, each instances of which
contains all the information needed conventional model, in which
program is seen as a list of tasks to perform. In OOP, each object is
capable of receiving messages, processing data, and sending messages
30
Encryption System
31
Encryption System
JAVA Features:
As we know that the Java is an object oriented programming
language developed by Sun Microsystems of USA in 1991. Java is first
programming language which is not attached with any particular
hardware or operating system. Program developed in Java can be
executed anywhere and on any system.
Features of Java are as follows:
1. Compiled and Interpreted
2. Platform Independent and portable
3. Object- oriented
4. Robust and secure
5. Distributed
6. Familiar, simple and small
7. Multithreaded and Interactive
8. High performance
9. Dynamic and Extensible
1. Compiled and Interpreted
Basically a computer language is either compiled or interpreted.
Java comes together both these approach thus making Java a two-stage
system.
Java compiler translates Java code to Byte code instructions and Java
Interpreter generate machine code that can be directly executed by
machine that is running the Java program.
2. Platform Independent and portable
Java supports the feature portability. Java programs can be easily
moved from one computer system to another and anywhere. Changes
and upgrades in operating systems, processors and system resources
will not force any alteration in Java programs. This is reason why Java
has become a trendy language for programming on Internet which
32
Encryption System
33
Encryption System
34
Encryption System
About Net Beans:Net Beans IDE is a free, open source, popular (with approximately 1
million downloads), integrated development environment used by many
developers. Out of the box, it provides built-in support for developing in
Java, C, C++, XML, and HTML. And this author especially likes the
support for editingJSPs, including syntax highlighting, HTML tag
completion, JSP tag completion, and Java codecompletion.
35
Encryption System
Features
Encryption System
Benefits
In order to successfully expand the business, the security level of
various application systems is enhanced to meet the requirement from
authorities or organizations.
Represent
process
incoming data.
37
that
transforms
Encryption System
Source/Sink.
ORIGINAL
FILE
Encryption
Using AES
Encryption key
ENCRIPTED DATA
ENCRIPTED DATA
Decryption
Using AES ORIGINAL
FILE
Fig 1
38
Encryption System
0 Level DFD
ENCRYPTION
SYSTEM
REMOTE
USER
NODE
1 Level DFD
ADMIN
MODULE
ADMINUSER
USER
FILE
CLIENT
MODULE
CLIENTUSER
39
Encryption System
USER
MANAGEMENT
ADMIN
USER
USER
FILE
REMOTE NODE
DECRYPTION
MODULE
STORE ENCRIPTION KEY
40
Encryption System
USER
USER
MANAGEMENT
MANAGEMENT
CLIENTUSER
CLIENT
USER
USER
FILE
RECEIVERECEIVE
DATA FROM
DATASERVER
FROM SERVER
DECRYPTION
DECRYPTION
MODULE
MODULE
41
SERVER
Encryption System
Select a file
Encrypt
Decrypt
Exit
Fig 2
42
Encryption System
Encryption System
44
Encryption System
45
Encryption System
4.2Procedural Design
A design methodology combines a systematic set of rules for
creating a program design with diagramming tools needed to represent
it. Procedural design is best used to model programs that have an
obvious flow of data from input to output. It represents the architecture
of a program as asset of interacting processes that pass data from one to
another.
Encrypt the clear text so that it does not make any sense at all.
The nonsense text is called cipher text. The encryption is
controlled by a secret password or number; this is called the
encryption key.
46
Encryption System
Fig 3
Fig 4
All of this only works under three conditions:
47
Encryption System
48
Encryption System
Fig 5
Encryption System
4.4Security Issues
Does security provide some very basic protections that we are
naive to believe that we don't need? During this time when the Internet
provides essential communication between tens of millions of people
50
Encryption System
application-to-application
Encryption System
52
Encryption System
53
Encryption System
Code Efficiency
Comments and descriptions are given to identify the
functions and to describe what the function is doing. Thus it
may be useful while finding errors and thus makes the
identifying of the function easy.
Login.java
packageadvancedencriptionsystem;
importjava.awt.Color;
importjava.io.BufferedReader;
importjava.io.FileReader;
importjava.io.IOException;
public class Login extends javax.swing.JFrame {
public Login() {
initComponents();
}
@SuppressWarnings("unchecked")
private void
jButton1ActionPerformed(java.awt.event.ActionEventevt) {
54
Encryption System
Encryption System
}
else
{
jLabel4.setBackground(Color.red);
jLabel4.setText("Please Enter Valid UserName And Password");
}
}
bin.close();
bin = null;
}catch(IOExceptionioe){
}
}
}
else
{
jLabel4.setBackground(Color.red);
jLabel4.setText("Please Enter UserName And Password" );
}
}
private void
jButton2ActionPerformed(java.awt.event.ActionEventevt) {
this.dispose();
56
Encryption System
}
public static void main(String args[]) {
//<editor-fold defaultstate="collapsed" desc=" Look and
feel setting code (optional) ">
try {
for (javax.swing.UIManager.LookAndFeelInfo info :
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException
ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(j
ava.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
57
Encryption System
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
publicbooleannullCheck(String userName, String password) {
if (userName.equals("") || password.equals("")) {
return false;
} else {
return true;
}
}
// Variables declaration - do not modify
privatejavax.swing.JButton jButton1;
privatejavax.swing.JButton jButton2;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JLabel jLabel3;
privatejavax.swing.JLabel jLabel4;
privatejavax.swing.JPanel jPanel1;
privatejavax.swing.JPasswordField jPasswordField1;
privatejavax.swing.JTextField jTextField1;
// End of variables declaration
}
AdminHome.java
58
Encryption System
packageadvancedencriptionsystem;
importjava.io.BufferedReader;
importjava.io.BufferedWriter;
importjava.io.File;
importjava.io.FileNotFoundException;
importjava.io.FileReader;
importjava.io.IOException;
importjava.io.InputStream;
importjava.io.InputStreamReader;
importjava.io.ObjectOutputStream;
importjava.io.OutputStream;
importjava.io.OutputStreamWriter;
importjava.io.PrintWriter;
importjava.net.InetAddress;
importjava.net.ServerSocket;
importjava.net.Socket;
importjava.net.UnknownHostException;
importjava.util.logging.Level;
importjava.util.logging.Logger;
importjavax.swing.DefaultListModel;
public class AdminHome extends javax.swing.JFrame {
private static Socket socket;
String number=null;
String path = "C:\\aes\\upload";
String path2 = "C:\\aes\\upload";
publicAdminHome() {
59
Encryption System
initComponents();
try {
String files;
File folder = new File(path);
File[] listOfFiles = folder.listFiles();
DefaultListModelresultList = new DefaultListModel();
for (int i = 0; i <listOfFiles.length; i++)
{
if (listOfFiles[i].isFile())
{
files = listOfFiles[i].getName();
resultList.addElement(files);
jList1.setModel(resultList);
}
}
60
Encryption System
private void
jButton1ActionPerformed(java.awt.event.ActionEventevt) {
newEncriptionform().setVisible(true);
}
private void
jButton5ActionPerformed(java.awt.event.ActionEventevt) {
int port = 1234;
String hostname = "localhost";
String input,output;
try {
Socket skt = new Socket(hostname, port);
BufferedReader in = new BufferedReader(new
InputStreamReader(skt.getInputStream()));
System.out.println("Server:" + in.readLine());
Encryption System
void
jButton7ActionPerformed(java.awt.event.ActionEventevt) {
try {
// TODO add your handling code here:
String files2;
File folder2 = new File(path2);
File[] listOfFiles2 = folder2.listFiles();
DefaultListModel resultList2 = new DefaultListModel();
for (int i = 0; i < listOfFiles2.length; i++)
{
if (listOfFiles2[i].isFile())
{
files2 = listOfFiles2[i].getName();
resultList2.addElement(files2);
}
}
ServerSocketmyServerSocket = new ServerSocket(9999);
Socket skt = myServerSocket.accept();
ObjectOutputStreamobjectOutput
new
ObjectOutputStream(skt.getOutputStream());
objectOutput.writeObject(resultList2);
objectOutput.flush();
skt.close();
myServerSocket.close();
} catch (IOException ex) {
Logger.getLogger(AdminHome.class.getName()).log(Level.
SEVERE, null, ex);
}
try {
int port = 25001;
ServerSocketserverSocket = new ServerSocket(port);
62
Encryption System
is
"+number);
is.close();
serverSocket.close();
socket.close();
jTextField2.setText(number);
}
} catch (IOException ex) {
Logger.getLogger(AdminHome.class.getName()).log(Level.
SEVERE, null, ex);
}
}
private
void
jButton4ActionPerformed(java.awt.event.ActionEventevt) {
// TODO add your handling code here:
}
private
void
jButton3ActionPerformed(java.awt.event.ActionEventevt) {
}
Private
void
jButton9ActionPerformed(java.awt.event.ActionEventevt) {
63
Encryption System
this.dispose();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
newAdminHome().setVisible(true);
}
});
}
// Variables declaration - do not modify
privatejavax.swing.JButton jButton1;
privatejavax.swing.JButton jButton2;
privatejavax.swing.JButton jButton3;
privatejavax.swing.JButton jButton4;
privatejavax.swing.JButton jButton5;
privatejavax.swing.JButton jButton6;
privatejavax.swing.JButton jButton7;
privatejavax.swing.JButton jButton8;
privatejavax.swing.JButton jButton9;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JLabel jLabel3;
privatejavax.swing.JList jList1;
privatejavax.swing.JList jList2;
privatejavax.swing.JScrollPane jScrollPane1;
privatejavax.swing.JScrollPane jScrollPane2;
privatejavax.swing.JSeparator jSeparator1;
privatejavax.swing.JSeparator jSeparator2;
privatejavax.swing.JTextField jTextField1;
privatejavax.swing.JTextField jTextField2;
// End of variables declaration
}
Encryptionform.java
packageadvancedencriptionsystem;
import
static
advancedencriptionsystem.CipherExample.encrypt;
importjava.io.BufferedWriter;
importjava.io.File;
importjava.io.FileInputStream;
importjava.io.FileNotFoundException;
importjava.io.FileOutputStream;
64
Encryption System
importjava.io.FileWriter;
importjava.io.IOException;
importjava.io.InputStream;
importjava.io.OutputStream;
importjava.util.logging.Level;
importjava.util.logging.Logger;
importjavax.crypto.Cipher;
importjavax.crypto.CipherInputStream;
importjavax.crypto.CipherOutputStream;
importjavax.crypto.SecretKey;
importjavax.crypto.SecretKeyFactory;
importjavax.crypto.spec.DESKeySpec;
importjavax.swing.JFileChooser;
public class Encriptionform extends javax.swing.JFrame {
String fname=null;
publicEncriptionform() {
initComponents();
}
private
void
jButton1ActionPerformed(java.awt.event.ActionEventevt) {
// TODO add your handling code here:
finalJFileChooser fc = new JFileChooser();
fc.showOpenDialog(this);
String f = fc.getSelectedFile().getAbsolutePath();
fname=fc.getSelectedFile().getName();
jTextField1.setText(f);
}
private
void
jButton2ActionPerformed(java.awt.event.ActionEventevt) {
// TODO add your handling code here:
String key = "squirrel123"+fname; // needs to be at least
8 characters for DES
byte[] Key = null;
try {
Key = encrypt(key);
//new AdminHome().setVisible(true);
this.dispose();
} catch (Exception ex) {
Logger.getLogger(Encriptionform.class.getName()).log(Lev
el.SEVERE, null, ex);
65
Encryption System
}
String strkey=null;
strkey=Key.toString();
System.out.println("....."+strkey);
FileInputStreamfis;
try {
String s=jTextField1.getText();
String result = s.replace("\\","/");
fis = new FileInputStream(result);
FileOutputStreamfos
=
new
FileOutputStream("C:\\aes\\upload\\"+fname+"");
encrypt(strkey, fis, fos);
} catch (FileNotFoundException ex) {
Logger.getLogger(Encriptionform.class.getName()).log(Lev
el.SEVERE, null, ex);
} catch (Throwable ex) {
Logger.getLogger(Encriptionform.class.getName()).log(Lev
el.SEVERE, null, ex);
}
FileOutputStream fop = null;
File file;
try {
FileWriterfw = new FileWriter("C:\\aes\\filekey.txt", true);
BufferedWriterbw = new BufferedWriter(fw);
bw.newLine();
String NL = System.getProperty("line.separator");
bw.write(fname+NL);
bw.write(strkey+NL);
bw.write("$$$"+NL);
bw.close();
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fop != null) {
try {
fop.close();
}
catch (IOException ex) {
Logger.getLogger(User_Registration.class.getName()).log(L
evel.SEVERE, null, ex);
}
}
}
66
Encryption System
}
private
void
jButton3ActionPerformed(java.awt.event.ActionEventevt) {
this.dispose();
}
public static void main(String args[]) {
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
newEncriptionform().setVisible(true);
}
});
}
public static byte[] encrypt(String x) throws Exception {
java.security.MessageDigest digest = null;
digest
java.security.MessageDigest.getInstance("SHA-1");
digest.reset();
digest.update(x.getBytes("UTF-8"));
returndigest.digest();
}
public static void encrypt(String key, InputStream is,
OutputStreamos) throws Throwable {
encryptOrDecrypt(key,
Cipher.ENCRYPT_MODE, is, os);
}
public static void decrypt(String key, InputStream is,
OutputStreamos) throws Throwable {
encryptOrDecrypt(key,
Cipher.DECRYPT_MODE, is, os);
}
public static void encryptOrDecrypt(String key, int
mode, InputStream is, OutputStreamos) throws Throwable {
67
Encryption System
DESKeySpecdks
new
DESKeySpec(key.getBytes());
SecretKeyFactoryskf
SecretKeyFactory.getInstance("DES");
SecretKeydesKey = skf.generateSecret(dks);
Cipher cipher = Cipher.getInstance("DES"); //
DES/ECB/PKCS5Padding for SunJCE
if (mode == Cipher.ENCRYPT_MODE) {
cipher.init(Cipher.ENCRYPT_MODE,
desKey);
CipherInputStreamcis
new
CipherInputStream(is, cipher);
doCopy(cis, os);
} else if (mode == Cipher.DECRYPT_MODE) {
cipher.init(Cipher.DECRYPT_MODE,
desKey);
CipherOutputStreamcos
new
CipherOutputStream(os, cipher);
doCopy(is, cos);
}
}
public
static
void
doCopy(InputStream
is,
Encryption System
User_Home.java
packageadvancedencriptionsystem;
import
static
advancedencriptionsystem.CipherExample.decrypt;
import
static
advancedencriptionsystem.Encriptionform.doCopy;
importjava.io.BufferedReader;
importjava.io.BufferedWriter;
importjava.io.File;
importjava.io.FileInputStream;
importjava.io.FileNotFoundException;
importjava.io.FileOutputStream;
importjava.io.FileReader;
importjava.io.IOException;
importjava.io.InputStream;
importjava.io.InputStreamReader;
importjava.io.ObjectInputStream;
importjava.io.OutputStream;
importjava.io.OutputStreamWriter;
importjava.io.PrintWriter;
importjava.net.InetAddress;
importjava.net.ServerSocket;
importjava.net.Socket;
importjava.net.UnknownHostException;
importjava.util.logging.Level;
importjava.util.logging.Logger;
importjavax.crypto.Cipher;
importjavax.crypto.CipherInputStream;
importjavax.crypto.CipherOutputStream;
importjavax.crypto.SecretKey;
importjavax.crypto.SecretKeyFactory;
importjavax.crypto.spec.DESKeySpec;
importjavax.swing.DefaultListModel;
public class User_Home extends javax.swing.JFrame {
private static Socket socket3;
private static Socket socket4;
publicUser_Home() {
initComponents();
try {
Socket socket = new Socket("192.168.1.26",9999);
DefaultListModel resultList2 = new DefaultListModel();
try {
69
Encryption System
ObjectInputStreamobjectInput
new
void
jButton2ActionPerformed(java.awt.event.ActionEventevt) {
try {
String msg=null;
Object obj=jList1.getSelectedValue();
msg=String.valueOf(obj);
String host = "192.168.1.26";
int port = 25001;
InetAddress address = InetAddress.getByName(host);
socket3 = new Socket(address, port);
//Send the message to the server
OutputStreamos = socket3.getOutputStream();
OutputStreamWriterosw = new OutputStreamWriter(os);
BufferedWriterbw = new BufferedWriter(osw);
String number = "2";
70
Encryption System
sent
to
the
server
"+sendMessage);
bw.flush();
} catch (UnknownHostException ex) {
Logger.getLogger(User_Home.class.getName()).log(Level.S
EVERE, null, ex);
} catch (IOException ex) {
Logger.getLogger(User_Home.class.getName()).log(Level.S
EVERE, null, ex);
}
InputStreamReaderisr;
BufferedReader br1;
try
{
System.out.println("aaa");
String host = "192.168.1.26";
int port = 25005;
System.out.println("bbb");
InetAddress address = InetAddress.getByName(host);
socket4 = new Socket(address, port);
//
Send the message to the server
System.out.println("aaaaa");
//Get the return message from the server
InputStream is = socket4.getInputStream();
System.out.println("ccc");
isr = new InputStreamReader(is);
System.out.println("ccc");
br1 = new BufferedReader(isr);
System.out.println("ccs");
System.out.println(""+br1.readLine());
String message = br1.readLine().toString();
System.out.println("ccc");
System.out.println("Message received from the server : "
+message);
//
jTextField1.setText(message);
}
catch (Exception exception)
71
Encryption System
{
exception.printStackTrace();
}
finally
{
//Closing the socket
try
{
socket4.close();
}
catch(Exception e)
{
e.printStackTrace();
}
}
}
private
void
jButton1ActionPerformed(java.awt.event.ActionEventevt) {
// TODO add your handling code here:
FileInputStream fis2 = null;
try {
// TODO add your handling code here:
String key=jTextField1.getText();
String filenm=null;
Object obj=jList1.getSelectedValue();
filenm=String.valueOf(obj);
System.out.println(""+filenm);
fis2
FileInputStream("C:\\aes\\upload\\"+filenm+"");
System.out.println("cvxcvxc");
FileOutputStream
fos2
=
new
new
FileOutputStream("C:\\aes\\download\\"+filenm+"");
decrypt(key, fis2, fos2);
} catch (FileNotFoundException ex) {
Logger.getLogger(User_Home.class.getName()).log(Level.S
EVERE, null, ex);
} catch (Throwable ex) {
Logger.getLogger(User_Home.class.getName()).log(Level.S
EVERE, null, ex);
} finally {
try {
fis2.close();
72
Encryption System
void
jButton3ActionPerformed(java.awt.event.ActionEventevt) {
InputStreamReaderisr;
BufferedReader br1;
try
{
System.out.println("aaa");
String host = "192.168.1.26";
int port = 25005;
System.out.println("bbb");
InetAddress address = InetAddress.getByName(host);
socket4 = new Socket(address, port);
//
Send the message to the server
System.out.println("aaaaa");
//Get the return message from the server
InputStream is = socket4.getInputStream();
System.out.println("ccc");
isr = new InputStreamReader(is);
System.out.println("ccc");
br1 = new BufferedReader(isr);
System.out.println("ccs");
System.out.println(""+br1.readLine());
String message = br1.readLine().toString();
System.out.println("ccc");
System.out.println("Message received from the server : "
+message);
//
jTextField1.setText(message);
}
catch (Exception exception)
{
exception.printStackTrace();
}
finally
{
73
Encryption System
void
jButton4ActionPerformed(java.awt.event.ActionEventevt) {
this.dispose();
// TODO add your handling code here:
}
public static void main(String args[]) {
setting code (optional) ">
try {
for (javax.swing.UIManager.LookAndFeelInfo
info
javax.swing.UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(info.getName())) {
javax.swing.UIManager.setLookAndFeel(info.getClassName
());
break;
}
}
} catch (ClassNotFoundException ex) {
java.util.logging.Logger.getLogger(User_Home.class.getNa
me()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(User_Home.class.getNa
me()).log(java.util.logging.Level.SEVERE, null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(User_Home.class.getNa
me()).log(java.util.logging.Level.SEVERE, null, ex);
}
catch
(javax.swing.UnsupportedLookAndFeelException ex) {
74
Encryption System
java.util.logging.Logger.getLogger(User_Home.class.getNa
me()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
newUser_Home().setVisible(true);
}
});
}
public void listFilesForFolder(final File folder) {
for (final File fileEntry : folder.listFiles()) {
if (fileEntry.isDirectory()) {
listFilesForFolder(fileEntry);
} else {
System.out.println(fileEntry.getName());
}
}
}
public static void encrypt(String key, InputStream is,
OutputStreamos) throws Throwable {
encryptOrDecrypt(key,
Cipher.ENCRYPT_MODE, is, os);
}
public static void decrypt(String key, InputStream is,
OutputStreamos) throws Throwable {
encryptOrDecrypt(key,
Cipher.DECRYPT_MODE, is, os);
}
public static void encryptOrDecrypt(String key, int
mode, InputStream is, OutputStreamos) throws Throwable {
DESKeySpecdks
DESKeySpec(key.getBytes());
SecretKeyFactoryskf
SecretKeyFactory.getInstance("DES");
SecretKeydesKey = skf.generateSecret(dks);
75
new
=
Encryption System
new
CipherInputStream(is, cipher);
doCopy(cis, os);
} else if (mode == Cipher.DECRYPT_MODE) {
cipher.init(Cipher.DECRYPT_MODE,
desKey);
CipherOutputStreamcos
CipherOutputStream(os, cipher);
doCopy(is, cos);
}
}
// Variables declaration - do not modify
privatejavax.swing.JButton jButton1;
privatejavax.swing.JButton jButton2;
privatejavax.swing.JButton jButton3;
privatejavax.swing.JButton jButton4;
privatejavax.swing.JLabel jLabel1;
privatejavax.swing.JLabel jLabel2;
privatejavax.swing.JList jList1;
privatejavax.swing.JScrollPane jScrollPane1;
privatejavax.swing.JTextField jTextField1;
// End of variables declaration
}
User_Registration.Java
packageadvancedencriptionsystem;
importjava.awt.Color;
importjava.io.BufferedWriter;
importjava.io.File;
importjava.io.FileOutputStream;
importjava.io.FileWriter;
importjava.io.IOException;
76
new
Encryption System
importjava.util.logging.Level;
importjava.util.logging.Logger;
public class User_Registration extends javax.swing.JFrame {
publicUser_Registration() {
initComponents();
}
private void jButton1ActionPerformed(java.awt.event.ActionEventevt)
{
String user=jTextField2.getText();
String pass=jPasswordField1.getText();
String conf=jPasswordField2.getText();
if(pass.equals(conf))
{
FileOutputStream fop = null;
File file;
String content = user+"\n"+pass+"\n"+"$$$";
try {
FileWriterfw = new FileWriter("C:\\aes\\login.txt", true);
BufferedWriterbw = new BufferedWriter(fw);
bw.newLine();
String NL = System.getProperty("line.separator");
bw.write(user+NL);
bw.write(pass+NL);
bw.write("$$$"+NL);
bw.close();
77
Encryption System
} catch (IOException e) {
e.printStackTrace();
} finally {
if (fop != null) {
try {
fop.close();
} catch (IOException ex) {
Logger.getLogger(User_Registration.class.getName()).log(Level.SEVE
RE, null, ex);
}
}
}
jTextField1.setText("");
jTextField2.setText("");
jPasswordField1.setText("");
jPasswordField2.setText("");
jLabel5.setText("");
}
else
{
jLabel5.setBackground(Color.red);
jLabel5.setText("password incorrect");
}
}
78
Encryption System
java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
newUser_Registration().setVisible(true);
}
});
}
Encryption System
Encryption System
of the project should be created out only after getting the approval
from the client.
Software testing is a critical element of Quality Assurance and
represents the ultimate provision of specification, design and coding.
Testing represents an interesting anomaly phase it was attempt to build
software from an abstract concept to a tangible implementation.
The testing phase involves the testing of the development system
using various test data. After preparing the test data the system under
study is tested using these test data. While testing the system using the
test data, errors were found and corrected. Thus a series of test were
performed system before the system was ready for implementation.
The various types of testing done on the system are:
Unit testing.
Integration testing.
Validation testing
Output testing.
User acceptance testing.
Black box testing.
White box testing.
81
Encryption System
Encryption System
Encryption files
Decryption files
Download files
Upload Files
Key Files
83
Encryption System
Login Form
Admin MainForm
84
Encryption System
85
Encryption System
CHAPTER 7: CONCLUSIONS
7.1 Conclusion
The whole system has been evaluated with simple data. It is
absolutely a menu driven system. The present system is free from all
sorts problem and drawbacks of existing system. This also feasible.
This software was developed with grater user friendliness,
because entire program are menu driven. So a new user can use it easily.
86
Encryption System
must
have
shared
some
secret
information
before
87
Encryption System
Time constraint:
The time giving for the submission of this project work was
not really enough for the researcher to extensively carry out more
research on this work.
Financial constraint:
There was not enough money to extensively carry out this work.
88
Encryption System
REFERENCES
www.google.com
http://en.wikipedia.org/wiki/AES_algorithm
Data Communications and Networking, 4th Edition, by
Behrouz A. Forouzan, Tata McGraw Hill
William Stalings,Cryptography and Network Security.
AES Key Generator for default keys used:
GLOSSARY
APPENDIX A
APPENDIX B
89
Encryption System
90