Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Mini Project Report-1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 39

UNIVERSITY OF MUMBAI

A DISSERTATION REPORT ON

“File Encryption and Decryption Using AES Algorithm”

SUBMITTED IN PARTIAL FULFILMENT FOR


THE REQUIREMENTS OF THE DEGREE

BACHELOR OF ENGINEERING
IN
COMPUTER ENGINEERING
GROUP MEMEBERS

Rajshree Borkar (03)


Ashish Gavade (08)
Shubham Khedeker (21)
SK Amjad Raza (49)

UNDER THE GUIDANCE OF

Dipti Raut

DEPARTMENT OF COMPUTER ENGINEERING


G.V. ACHARYA INSTITUTE OF ENGINEERING AND TECHNOLOGY
UNIVERSITY OF MUMBAI
2020-2021
DECLARATION

I declare that this written submission represents my ideas in my own words and where others'
ideas or words have been included, I have adequately cited and referenced the original
sources. I also declare that I have adhered to all principles of academic honesty and integrity
and have not misrepresented or fabricated or falsified any idea/data/fact/source in my
submission. I understand that any violation of the above will be cause for disciplinary action
by the Institute and can also evoke penal action from the sources which have thus not been
properly cited or from whom proper permission has not been taken when needed.

Date:

Place: SHELU
PROJECT REPORT APPROVAL FOR S.E.

This project report entitled “File Encryption and Decryption Using AES Algorithm” by
“Rajshree Borkar (03)”, “Ashish Gavade (08)”, “Shubham Khedeker (21)”, “SK
Mohmad Amjad Raza (49)” is approved for the degree of “Second Year of Computer
Engineering”.

Examiners
1.

2.

Date:

Place: SHELU
CERTIFICATE

This is to certify that the project entitled “File Encryption and Decryption Using AES
Algorithm” is a bonafide work of “Rajshree Borkar (03)”, “Ashish Gavade (08)”,
“Shubham Khedeker (21)”, “SK Mohmad Amjad Raza (49)”, “submitted to the
University of Mumbai in partial fulfillment of the requirement for the award of the degree of
“Undergraduate” in “Second Year of Computer Engineering”.

Prof. Dipti Raut. Prof. Roshan Bauskar.


Project Guide Head of Department
Department of Computer Engineering Computer Engineering
G.V.A.I.E.T G.V.A.I.E.T

Prof. Dipti Raut. Dr. Prashant Sonare.


Project Co-Ordinator Principle
Department of Computer Engineering G.V.A.I.E.T
ACKNOWLEDGEMENT

We have immense pleasure in presenting the report for our project entitled “File Encryption and
Decryption Using AES Algorithm”.

We would like to take this opportunity to express our gratitude to a number of people
who have been sources of help & encouragement during the courses of this project.

We are very graceful and indebted to our project guide & our respected HOD for
providing their enduring patience, guidance, & suggestions. They were the one who
never let our morale down & always supported us through our thick & thin. They were
the constant source of inspiration for us & took at most interest in our project.

We would also like to thank all the staff members for their invaluable co-operation &
permitting us to work in the computer lab.

We are also thankful to all the students for giving us their useful advice & immense co-
operation. Their support made the working of this project very pleasant.

Group Members
Rajshree Borkar (03)

Ashish Gavade (08)

Shubham Khedekar (21)

SK Mohmad Amjad Raza Mohmad Irfan (49)


TABLE OF CONTENT
ABSTRACT
1. INTRODUCTION
1.1 Overview
1.2 Aim and objective
1.3 Problem Statement
1.4 Features of AES Algorithm
1.5 System Requirements

2. IMPLEMENTED SYSTEM
2.1 Introduction
2.2 System Architecture
3. PROJECT DESIGN
3.1 Flow Chart
3.2 Sequence Diagram
3.3 Use-Case Diagram
4. CODING
5. SNAPSHOTS
6. TESTING
6.1 SOFTWARE TESTING
6.1.1 System Testing
6.1.2 Unit Testing
6.1.3 Integration Testing
6.1.4 Functional Testing
6.2 Testing Method
6.2.1 Black Box Testing
6.2.2 White Box Testing
7. ADVANTAGES & DISADVANTAGES
8. CONCLUSION & FUTURE SCOPE
9. REFERENCES
ABSTRACT

Data security is a major issue which we are facing today in this digital world
of communication. As we know that today hackers are almost at every corner in search
of our useful data which can be hacked by them for their different purposes. Even the
risk gets doubled when come to the data of any country’s government. So, a system or
terminology is must require to make that data safe forever by any means during
communication.

Data protection can be accomplished by changing the original data by any


means to some other un useful data so that if someone gets that data then also it must
remain in un useful bits. This process can be achieved by Encrypting that data by some
means of algorithms which are known to the sender and the similar Decryption
algorithms to be known to only the desired receiver so that it can convert that
encrypted data back to the user understandable form. Today as it is a need to develop
such kind of applications which performs the specified task but along with it should be
very much user friendly so that no special skills need to be required to learn in order to
use that application or project.

In the application the user has to select either wants to send something by
encrypting or wants to receive by decrypting. If it wants to send then it has to select
source file previously designed or type some message which is to Encrypt and then
transfer. Whereas on the receiver side again the receiver has to select the file which is
to be received from the sender along with a decryption key to decrypt that message.
Decryption key can be selected either manually if told by the sender or selecting key
sent by the sender along with the encrypted data to avoid further delay in processing
the message.
INTRODUCTION

1.1 Overview:

This project is all about the Data Security. How we can secure our data from hackers.
The symmetric-key block cipher plays an important role in data encryption. It means that the
same key is used for both encryption and decryption. The Advanced Encryption Standard
(AES) is a widely used symmetric-key encryption algorithm.

In this project, we’ll see how to implement AES encryption and decryption using the Python on the
any kind of files using pycryptodomex package.

Aim and Objective:

As we know that today hackers are almost at every corner in search of our useful data
which can be hacked by them for their different purposes. Even the risk gets doubled when
come to the data of any country’s government. So, a system or terminology is must require to
make that data safe forever by any means during communication. So the main aim of the
project is to secure our important data from hackers and keep it safe.

1.2 Problem Statement:

Many organizations today are facing difficulties in choosing the best encryption and
decryption algorithms for incorporating data security, confidentiality, and integrity in their
businesses. Organizations need huge budget for analyzing the encryption processing
overhead of a variety of cryptographic algorithms that are available in the market today

1.3 Features of AES Algorithm

 Block encryption implementation.


 128-bit group encryption with 128, 192 and 256-bit key lengths.
 Symmetric algorithm requiring only one encryption and decryption key.
 Data security for 20-30 years.
 Worldwide access.
 Easy overall implementation.

1.4 System Requirements:


 Compatible with windows
 Latest version of Python
 RAM Minimum 4G
IMPLEMENTED SYSTEM
2.1 Introduction:
Encryption:
Encryption is a process used to protect data stored in the cloud from unauthorized
users. In other words, the primary purpose of encryption is confidentiality. This technique is
advancing day by day. The modern encryption along with confidentiality, they provide key
elements of security. They are listed below:
1. Authentication
2. Integrity
3. Non- repudiation
Individual files on a computer can be encrypted to resist the adversary's attempts to
read the contents of the file. This is useful for particularly sensitive files on a computer, but is
also useful for application-level transfer of files across an insecure channel such as email.
Figure shows the working of encryption technique.

Decryption:
It is generally a reverse process of encryption. It decodes the encrypted information so
that an authorized user can only decrypt the data because decryption requires a secret key or
password.
2.2 SYSTEM ARCHITECTURE

System architecture is the conceptual model that defines the structure, behavior,
and more views of a system. An architecture description is a formal description and
representation of a system, organized in a way that supports reasoning about the structures
and behaviors of the system.

In our system architecture, sender send any kind of file it can be text, image, excel,
etc., the file which we have to encrypt and we have to set an encryption key for encrypted
method. After encryption the cipher data is used for decryption of file data in which we have
to copy the encrypted file and then enter the key set while encryption and the encrypted file
will be decrypted into its original form.
PROJECT DESIGN

3.1 Flow Chart

Encryption:-
Decryption:-
3.2 Sequence Diagram:

A sequence diagram simply depicts interaction between objects in a sequential order i.e. the
order in which these interactions take place. We can also use the terms event diagrams or
event scenarios to refer to a sequence diagram. Sequence diagrams describe how and in what
order the objects in a system function.

In this sequential diagram, sender send any kind of file it can be text, image, excel, etc., the
file which we have to encrypt and we have to set an encryption key for encrypted method.
After encryption the cipher data is used for decryption of file data in which we have to copy
the encrypted file and then enter the key set while encryption and the encrypted file will be
decrypted into its original form.
3.3 Use -Case Diagram:

A use case is a methodology used in system analysis to identify, clarify and organize system
requirements. The use case is made up of a set of possible sequences of interactions between
systems and users in a particular environment and related to a particular goal.

In this, sender sends the file (text file, image file etc.), the file which we have to encrypt and
we have to set an encryption key for encryption logic. After encryption the cipher data is used
for decryption of file in which we have to drive the encrypted file and then enter the key set
while encryption and the encrypted file will be decrypted.
CODING
Encryption File:-
import os
import sys
import hashlib
import tkinter as tk
from tkinter import filedialog
from tkinter import messagebox
from Cryptodome.Cipher import AES

class EncryptionTool:

def init (self, user_file, user_key, user_salt):


self.user_file = user_file
self.input_file_size = os.path.getsize(self.user_file)
self.chunk_size = 1024
self.total_chunks = (self.input_file_size // self.chunk_size)
+ 1
self.user_key = bytes(user_key, "utf-8")
self.user_salt = bytes(user_key[::-1], "utf-8")
self.file_extension = self.user_file.split(".")[-1]
self.hash_type = "SHA256"
self.encrypt_output_file =
".".join(self.user_file.split(".")[:-1]) \
+ "." + self.file_extension +
".encr"
self.hashed_key_salt = dict()
self.hash_key_salt()
def read_in_chunks(self, file_object, chunk_size=1024):

while True:
data = file_object.read(chunk_size)
if not data:
break
yield data

def encrypt(self):
cipher_object = AES.new(
self.hashed_key_salt["key"],
AES.MODE_CFB,
self.hashed_key_salt["salt"]
)

self.abort()

input_file = open(self.user_file, "rb")


output_file = open(self.encrypt_output_file, "ab")
done_chunks = 0

for piece in self.read_in_chunks(input_file,


self.chunk_size):
encrypted_content = cipher_object.encrypt(piece)
output_file.write(encrypted_content) done_chunks
+= 1
yield (done_chunks / self.total_chunks) * 100

input_file.close()
output_file.close()

del cipher_object

def abort(self):
if os.path.isfile(self.encrypt_output_file):
os.remove(self.encrypt_output_file)

def hash_key_salt(self):
hasher = hashlib.new(self.hash_type)
hasher.update(self.user_key)

self.hashed_key_salt["key"] = bytes(hasher.hexdigest()[:32],
"utf-8")

del hasher

hasher = hashlib.new(self.hash_type)
hasher.update(self.user_salt)

self.hashed_key_salt["salt"] = bytes(hasher.hexdigest()[:16],
"utf-8")

del hasher

class MainWindow:

THIS_FOLDER_G = ""
if getattr(sys, "frozen", False):
THIS_FOLDER_G = os.path.dirname(sys.executable)
else:
THIS_FOLDER_G = os.path.dirname(os.path.realpath( file ))

def init (self, root):


self.root = root
self._cipher = None
self._file_url = tk.StringVar()
self._secret_key = tk.StringVar()
self._salt = tk.StringVar()
self._status = tk.StringVar()
self._status.set("")

self.should_cancel = False

root.title("FILE ENCYPTION")
root.configure(bg="#FCE0E8")
try:
icon_img = tk.Image(
"photo",
file=self.THIS_FOLDER_G + "/assets/icon.png"
)
root.call(
"wm",
"iconphoto",
root._w,
icon_img
)
except Exception:
pass

self.menu_bar = tk.Menu(
root,
bg="#FCE0E8",
relief=tk.FLAT
)
self.menu_bar.add_command( label="Help
", command=self.show_help_callback
)
self.menu_bar.add_command( label=
"Exit", command=root.quit
)

root.configure( menu=s
elf.menu_bar
)

self.file_entry_label = tk.Label(
root,
text="Enter File Path Or Click DERIVE FILE Button",
bg="#FCE0E8",
anchor=tk.W
)
self.file_entry_label.grid( padx=
12,
pady=(8, 0),
ipadx=0,
ipady=1,
row=0,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.file_entry = tk.Entry(
root,
textvariable=self._file_url,
bg="#fff",
exportselection=0,
relief=tk.FLAT
)
self.file_entry.grid(
padx=15,
pady=6,
ipadx=8,
ipady=8,
row=1,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.select_btn = tk.Button(
root,
text="DERIVE FILE",
command=self.selectfile_callback,
width=42,
bg="#1089ff",
fg="#ffffff",
bd=2,
relief=tk.FLAT
)
self.select_btn.grid(
padx=15,
pady=8,
ipadx=24,
ipady=6,
row=2,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.key_entry_label = tk.Label(
root,
text="Enter Secret Key",
bg="#FCE0E8",
anchor=tk.W
)
self.key_entry_label.grid( padx=1
2,
pady=(8, 0),
ipadx=0,
ipady=1,
row=3,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.key_entry = tk.Entry(
root,
textvariable=self._secret_key,
bg="#fff",
exportselection=0,
relief=tk.FLAT
)
self.key_entry.grid(
padx=15, pady=6,
ipadx=8,
ipady=8,
row=4,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.encrypt_btn = tk.Button(
root,
text="ENCRYPT FILE",
command=self.encrypt_callback,
bg="#FF2428",
fg="#ffffff",
bd=2,
relief=tk.FLAT
)
self.encrypt_btn.grid(
padx=(120, 6),
pady=8,
ipadx=24,
ipady=6,
row=7,
column=0,
columnspan=2,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.reset_btn = tk.Button(
root,
text="RESET",
command=self.reset_callback,
bg="#676767",
fg="#ffffff",
bd=2,
relief=tk.FLAT
)
self.reset_btn.grid(
padx=15,
pady=(4, 12),
ipadx=24,
ipady=6,
row=8,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.status_label = tk.Label(
root,
textvariable=self._status,
bg="#FCE0E8",
anchor=tk.W,
justify=tk.LEFT,
relief=tk.FLAT,
wraplength=350
)
self.status_label.grid(
padx=12,
pady=(0, 12),
ipadx=0,
ipady=1,
row=9,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

tk.Grid.columnconfigure(root, 0, weight=1)
tk.Grid.columnconfigure(root, 1, weight=1)
tk.Grid.columnconfigure(root, 2, weight=1)
tk.Grid.columnconfigure(root, 3, weight=1)

def selectfile_callback(self):
try:
name = filedialog.askopenfile()
self._file_url.set(name.name) #
print(name.name)
except Exception as e:
self._status.set(e)
self.status_label.update()

def freeze_controls(self):
self.file_entry.configure(state="disabled")
self.key_entry.configure(state="disabled")
self.select_btn.configure(state="disabled")
self.encrypt_btn.configure(state="disabled")
self.reset_btn.configure(text="CANCEL",
command=self.cancel_callback,
fg="#ed3833", bg="#fafafa")
self.status_label.update()

def unfreeze_controls(self):
self.file_entry.configure(state="normal")
self.key_entry.configure(state="normal")
self.select_btn.configure(state="normal")
self.encrypt_btn.configure(state="normal")
self.reset_btn.configure(text="RESET",
command=self.reset_callback,
fg="#ffffff", bg="#676767")
self.status_label.update()

def encrypt_callback(self):
self.freeze_controls()
try:
self._cipher = EncryptionTool(
self._file_url.get(),
self._secret_key.get(),
self._salt.get()
)
for percentage in self._cipher.encrypt():
if self.should_cancel:
break
percentage = "{0:.2f}%".format(percentage)
self._status.set(percentage)
self.status_label.update()
self._status.set("Your File is Encrypted!")
if self.should_cancel:
self._cipher.abort()
self._status.set("Cancelled!")
self._cipher = None
self.should_cancel = False
except Exception as e:
self._status.set(e)

self.unfreeze_controls()

def reset_callback(self):
self._cipher = None
self._file_url.set("")
self._secret_key.set("")
self._salt.set("")
self._status.set("")
def cancel_callback(self):
self.should_cancel = True
def show_help_callback(self):
messagebox.showinfo(
"Help",
"""1. Open the App and Click SELECT FILE Button and
select your file e.g. "abc.jpg".

2. Enter your Secret Key (This can be any alphanumeric letters).


Remember this so you can Decrypt the file later.

3. Click ENCRYPT Button to encrypt. A new encrypted file with ".encr"


extention e.g. "abc.jpg.encr" will be created in the same directory
where the "abc.jpg" is.

4. Click RESET Button to reset the input fields and status bar.

5. You can also Click CANCEL Button during Encryption/Decryption to


stop the process."""
)
if name == " main ":
ROOT = tk.Tk()
MAIN_WINDOW = MainWindow(ROOT)
ROOT.mainloop()
Decryption File:-
import os
import encrypt
import sys
import hashlib
import tkinter as tk
from tkinter import filedialog
from tkinter import messagebox
from Cryptodome.Cipher import AES

class EncryptionTool:

def init (self, user_file, user_key, user_salt):


self.user_file = user_file

self.input_file_size = os.path.getsize(self.user_file)
self.chunk_size = 1024
self.total_chunks = (self.input_file_size // self.chunk_size)
+ 1

self.user_key = bytes(user_key, "utf-8")


self.user_salt = bytes(user_key[::-1], "utf-8")

self.file_extension = self.user_file.split(".")[-1]

self.hash_type = "SHA256"

self.encrypt_output_file =
".".join(self.user_file.split(".")[:-1]) \
+ "." + self.file_extension + ".encr"

self.decrypt_output_file = self.user_file[:-5].split(".")
self.decrypt_output_file =
".".join(self.decrypt_output_file[:-1]) \
+ "_Decrypted_." + self.decrypt_output_file[-1]

self.hashed_key_salt = dict()

self.hash_key_salt()

def read_in_chunks(self, file_object, chunk_size=1024):

while True:
data = file_object.read(chunk_size)
if not data:
break
yield data

def decrypt(self):
cipher_object = AES.new(
self.hashed_key_salt["key"],
AES.MODE_CFB,
self.hashed_key_salt["salt"]
)

self.abort()

input_file = open(self.user_file, "rb")


output_file = open(self.decrypt_output_file, "xb")
done_chunks = 0

for piece in self.read_in_chunks(input_file):


decrypted_content = cipher_object.decrypt(piece)
output_file.write(decrypted_content) done_chunks
+= 1
yield (done_chunks / self.total_chunks) * 100

input_file.close()
output_file.close()

del cipher_object

def abort(self):
if os.path.isfile(self.decrypt_output_file):
os.remove(self.decrypt_output_file)

def hash_key_salt(self):
hasher = hashlib.new(self.hash_type)
hasher.update(self.user_key)

self.hashed_key_salt["key"] = bytes(hasher.hexdigest()[:32],
"utf-8")

del hasher

hasher = hashlib.new(self.hash_type)
hasher.update(self.user_salt)

self.hashed_key_salt["salt"] = bytes(hasher.hexdigest()[:16],
"utf-8")

del hasher

class MainWindow:

THIS_FOLDER_G = ""
if getattr(sys, "frozen", False):
THIS_FOLDER_G = os.path.dirname(sys.executable)
else:
THIS_FOLDER_G = os.path.dirname(os.path.realpath( file ))

def init (self, root):


self.root = root
self._cipher = None
self._file_url = tk.StringVar()
self._secret_key = tk.StringVar()
self._salt = tk.StringVar()
self._status = tk.StringVar()
self._status.set("")

self.should_cancel = False

root.title("FILE DECRYPTION")
root.configure(bg="#FCE0E8")

try:
icon_img = tk.Image(
"photo",
file=self.THIS_FOLDER_G + "/assets/icon.png"
)
root.call(
"wm",
"iconphoto",
root._w,
icon_img
)
except Exception:
pass

self.menu_bar = tk.Menu(
root,
bg="#FCE0E8",
relief=tk.FLAT
)
self.menu_bar.add_command( label="Help
", command=self.show_help_callback
)
self.menu_bar.add_command( label=
"Exit", command=root.quit
)

root.configure( menu=s
elf.menu_bar
)

self.file_entry_label = tk.Label(
root,
text="Enter File Path Or Click DERIVE FILE Button",
bg="#FCE0E8",
anchor=tk.W
)
self.file_entry_label.grid( padx=
12,
pady=(8, 0),
ipadx=0,
ipady=1,
row=0,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.file_entry = tk.Entry(
root,
textvariable=self._file_url,
bg="#fff",
exportselection=0,
relief=tk.FLAT
)
self.file_entry.grid(
padx=15,
pady=6,
ipadx=8,
ipady=8,
row=1,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.select_btn = tk.Button(
root,
text="DERIVE ENCRYPTED FILE",
command=self.selectfile_callback,
width=42,
bg="#1089ff",
fg="#ffffff",
bd=2,
relief=tk.FLAT
)
self.select_btn.grid(
padx=15,
pady=8,
ipadx=24,
ipady=6,
row=2,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.key_entry_label = tk.Label(
root,
text="Enter Secret Key",
bg="#FCE0E8",
anchor=tk.W
)
self.key_entry_label.grid( padx=1
2,
pady=(8, 0),
ipadx=0,
ipady=1,
row=3,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.key_entry = tk.Entry(
root,
textvariable=self._secret_key,
bg="#fff",
exportselection=0,
relief=tk.FLAT
)
self.key_entry.grid(
padx=15, pady=6,
ipadx=8,
ipady=8,
row=4,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.decrypt_btn = tk.Button(
root,
text="DECRYPT FILE",
command=self.decrypt_callback,
bg="#0FCD00",
fg="#ffffff",
bd=2,
relief=tk.FLAT
)
self.decrypt_btn.grid(
padx=(6, 120),
pady=8,
ipadx=24,
ipady=6,
row=7,
column=2,
columnspan=2,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.reset_btn = tk.Button(
root,
text="RESET",
command=self.reset_callback,
bg="#676767",
fg="#ffffff",
bd=2,
relief=tk.FLAT
)
self.reset_btn.grid(
padx=15,
pady=(4, 12),
ipadx=24,
ipady=6,
row=8,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

self.status_label = tk.Label(
root,
textvariable=self._status,
bg="#FCE0E8",
anchor=tk.W,
justify=tk.LEFT,
relief=tk.FLAT,
wraplength=350
)
self.status_label.grid(
padx=12,
pady=(0, 12),
ipadx=0,
ipady=1,
row=9,
column=0,
columnspan=4,
sticky=tk.W+tk.E+tk.N+tk.S
)

tk.Grid.columnconfigure(root, 0, weight=1)
tk.Grid.columnconfigure(root, 1, weight=1)
tk.Grid.columnconfigure(root, 2, weight=1)
tk.Grid.columnconfigure(root, 3, weight=1)

def selectfile_callback(self):
try:
name = filedialog.askopenfile()
self._file_url.set(name.name) #
print(name.name)
except Exception as e:
self._status.set(e)
self.status_label.update()

def freeze_controls(self):
self.file_entry.configure(state="disabled")
self.key_entry.configure(state="disabled")
self.select_btn.configure(state="disabled")
self.decrypt_btn.configure(state="disabled")
self.reset_btn.configure(text="CANCEL",
command=self.cancel_callback,
fg="#ed3833", bg="#fafafa")
self.status_label.update()

def unfreeze_controls(self):
self.file_entry.configure(state="normal")
self.key_entry.configure(state="normal")
self.select_btn.configure(state="normal")
self.decrypt_btn.configure(state="normal")
self.reset_btn.configure(text="RESET",
command=self.reset_callback,
fg="#ffffff", bg="#676767")
self.status_label.update()

def decrypt_callback(self):
self.freeze_controls()

try:
self._cipher = EncryptionTool(
self._file_url.get(),
self._secret_key.get(),
self._salt.get()
)
for percentage in self._cipher.decrypt():
if self.should_cancel:
break
percentage = "{0:.2f}%".format(percentage)
self._status.set(percentage)
self.status_label.update()
self._status.set("Your File is Decrypted!")
if self.should_cancel:
self._cipher.abort()
self._status.set("Cancelled!")
self._cipher = None
self.should_cancel = False
except Exception as e:
self._status.set(e)

self.unfreeze_controls()

def reset_callback(self):
self._cipher = None
self._file_url.set("")
self._secret_key.set("")
self._salt.set("")
self._status.set("")

def cancel_callback(self):
self.should_cancel = True

def show_help_callback(self):
messagebox.showinfo(
"Help",
"""1. Open the App and Click SELECT FILE Button and
select Encrypted file e.g. "abc.jpg".

2. Enter your Secret Key (This can be any alphanumeric letters).


Remember this so you can Decrypt the file later.

3. Click ENCRYPT Button to encrypt. A new encrypted file with ".encr"


extention e.g. "abc.jpg.encr" will be created in the same directory
where the "abc.jpg" is.

4. When you want to Decrypt a file you, will select the file with the
".encr" extention and Enter your Secret Key which you chose at the
time of Encryption. Click DECRYPT Button to decrypt. The decrypted
file will be of the same name as before with the suffix "_Decrypted_"
e.g. "abc_Decrypted_.jpg".

Click RESET Button to reset the input fields and status bar.

You can also Click CANCEL Button during Encryption/Decryption to stop


the process."""
)

if name == " main ": ROOT =


tk.Tk()
MAIN_WINDOW = MainWindow(ROOT)
ROOT.mainloop()
SNAPSHOTS
RESULT ANALYSIS:-

Selecting a File for Encryption:-


Encrypted file should look like this:-

Now select Encrypted (.encr) file for Decryption:-


When click on Decrypt with proper secret key the application will be automatically
convert encrypted file (.encr) to its original file :-

Final Output was the Decrypted file with the suffix "_Decrypted_" :-
SOFTWARE TESTING

6.1 Software Testing:

Software testing is an investigation conducted to provide stakeholders with


information about the quality of the software product or service under test. [1] Software testing
can also provide an objective, independent view of the software to allow the business to
appreciate and understand the risks of software implementation. Test techniques include the
process of executing a program or application with the intent of finding software bugs (errors
or other defects) and verifying that the software product is fit for use.

Software testing involves the execution of a software component or system component to


evaluate one or more properties of interest. In general, these properties indicate the extent to
which the component or system under test

 Meets the requirements that guided its design and development,


 Responds correctly to all kinds of inputs,
 Performs its functions within an acceptable time,
 Is sufficiently usable,
 Can be installed and run in its intended environments, and
 Achieves the general result its stakeholder’s desire.

As the number of possible tests for even simple software components is practically
infinite, all software testing uses some strategy to select tests that are feasible for the
available time and resources. As a result, software testing typically (but not exclusively)
attempts to execute a program or application with the intent of finding software bugs (errors
or other defects). The job of testing is an iterative process as when one bug is fixed; it can
illuminate other, deeper bugs, or can even create new ones.

Software testing can provide objective, independent information about the quality of
software and risk of its failure to users or sponsors.

Software testing can be conducted as soon as executable software (even if partially


complete) exists. The overall approach to software development often determines when and
how testing is conducted. For example, in a phased process, most testing occurs after system
requirements have been defined and then implemented in testable programs. In contrast,
under an agile approach, requirements, programming, and testing are often done
concurrently.
6.1.1 System Testing

System testing of software or hardware is testing conducted on a complete, integrated


system to evaluate the system's compliance with its specified requirements. System testing
falls within the scope of black-box testing, and as such, should require no knowledge of the
inner design of the code or logic.[1]

As a rule, system testing takes, as its input, all of the "integrated" software
components that have passed integration testing and also the software system itself integrated
with any applicable hardware system(s). The purpose of integration testing is to detect any
inconsistencies between the software units that are integrated together (called assemblages)
or between any of the assemblages and the hardware. System testing is a more limited type of
testing; it seeks to detect defects both within the "inter-assemblages" and also within the
system as a whole.

6.1.2 Unit Testing

Unit Testing is a software testing method by which individual units of source code,
sets of one or more computer program modules together with associated control data, usage
procedures, and operating procedures, are tested to determine whether they are fit for use.
Intuitively, one can view a unit as the smallest testable part of an application. In procedural
programming, a unit could be an entire module, but it is more commonly an individual
function or procedure. In object-oriented programming, a unit is often an entire interface,
such as a class, but could be an individual method.

Unit tests are short code fragments created by programmers or occasionally by white
box testers during the development process. It forms the basis for component testing. Ideally,
each test case is independent from the others. Substitutes such as method stubs, mock objects,
fakes, and test harnesses can be used to assist testing a module in isolation. Unit tests are
typically written and run by software developers to ensure that code meets its design and
behaves as intended.

6.1.3 Integration Testing

Integration testing (sometimes called integration and testing, abbreviated I&T) is the
phase in software testing in which individual software modules are combined and tested as a
group. It occurs after unit testing and before validation testing. Integration testing takes as its
input modules that have been unit tested, groups them in larger aggregates, applies tests
defined in an integration test plan to those aggregates, and delivers as its output the integrated
system ready for system testing.

6.1.4 Functional Testing

Functional testing is a quality assurance (QA) process and a type of black-box testing
that bases its test cases on the specifications of the software component under test. Functions
are tested by feeding them input and examining the output, and internal program structure is
rarely considered Functional testing usually describes what the system does.

Functional testing does not imply that you are testing a function (method) of your module or
class. Functional testing tests a slice of functionality of the whole system.

Function testing is centered on the following items:

Valid Input: Identified classes of valid input must be accepted.

Invalid Input: Identified classes of invalid input must be

rejected. Functions: Identified functions must be exercised.

Output: Identified classes of application outputs must be exercised.

Procedures: Interfacing system or procedures must be invoked.

6.2Testing Method:

6.2.1 Black Box Testing


Black-box testing treats the software as a "black box", examining functionality without
any knowledge of internal implementation, without seeing the source code. The testers are
only aware of what the software is supposed to do, not how it does it.[15] Black-box testing
methods include: equivalence partitioning, boundary value analysis, all-pairs testing, state
transition tables, decision table testing, fuzz testing, model-based testing, use
case testing, exploratory testing, and specification-based testing.
Specification-based testing aims to test the functionality of software according to the
applicable requirements. This level of testing usually requires thorough test cases to be
provided to the tester, who then can simply verify that for a given input, the output value (or
behavior), either "is" or "is not" the same as the expected value specified in the test case. Test
cases are built around specifications and requirements, i.e., what the application is supposed
to do. It uses external descriptions of the software, including specifications, requirements, and
designs to derive test cases. These tests can be functional or non-functional, though usually
functional.

6.1.2 White Box Testing


White-box testing (also known as clear box testing, glass box testing, and transparent
box testing and structural testing, by seeing the source code) tests internal structures or
workings of a program, as opposed to the functionality exposed to the end-user. In white-box
testing, internal perspectives of the system, as well as programming skills, are used to design
test cases.

The tester chooses inputs to exercise paths through the code and determine the
appropriate outputs. While white-box testing can be applied at
the unit, integration and system levels of the software testing process, it is usually done at the
unit level. It can test paths within a unit, paths between units during integration, and between
subsystems during a system–level test. Though this method of test design can uncover many
errors or problems, it might not detect unimplemented parts of the specification or missing
requirements.
ADVANTAGES & DISADVANTAGES

Benefits or advantages of AES


Following are the benefits or advantages of AES:

 As it is implemented in both hardware and software, it is most robust security


protocol.
 It uses higher length key sizes such as 128, 192 and 256 bits for encryption. Hence it
makes AES algorithm more robust against hacking.
 It is most common security protocol used for wide various of applications such as
wireless communication, financial transactions, e-business, encrypted data storage etc.
 It is one of the most spread commercial and open source solutions used all over the
world.
 No one can hack your personal information.
 For 128 bits, about 2128 attempts are needed to break. This makes it very difficult to
hack it as a result it is very safe protocol.

Drawbacks or disadvantages of AES


Following are the disadvantages of AES:

 It uses too simple algebraic structure.


 Every block is always encrypted in the same way.
 Hard to implement with software.
 AES in counter mode is complex to implement in software taking both performance
and security into considerations.
CONCLUSION & FUTURE SCOPE
8.1 Conclusion:
It can be concluded that this project works efficiently for offline purpose at any
place provided the requirements for running environment remains same. Users need not to
worry about how the algorithm actually works inside the instruction set performed by the
compiler.

8.2 Future Scope:


1. In Future, Data Encryption and Decryption system can be updated further
which can provide more secured encryption algorithms like DES, AES etc.
2. This project can be made more attractive and easier to use by implementing
GUI (Graphical User Interface) with the help of many coding platforms like
Eclipse etc.
3. In Future, We could work on selection of a larger key size which would make
the algorithm is more secure, and a larger input block to increase the
throughput.
REFERENCES

 Yenuguvanilanka. J., & Elkeelany, O. (2008. April). Performance evaluation of hardware models

of Advanced Encryption Standard (AES) algorithm. In Southeastcon, 2008. IEEE (pp. 222-225).

 Lu. C. C.. & Tseng, S. Y. (2002). Integrated design of AES (Advanced Encryption Standard)

encrypter and decrypter. In Application-Specific Systems. Architectures and Processors. 2002.

Proceedings. The IEEE International Conference on (pp. 277-285).

 “AES Website”, https://en.wikipedia.org/wiki/Advanced_Encryption_Standard

 “Python Website”, http://www.en.wikipedia.org/wiki/Python (Programming_language)

 Mohamed. A. A., & Madian, A. H. (2010. December). A Modified Rijndael Algorithm and its

Implementation using FPGA. In Electronics. Circuits, and Systems (ICECS), 2010 17th IEEE

International Conference on (pp. 335-338).

 Deshpande. H. S., Karande, K. J., & Mulani, A. 0. (2014. April). Efficient implementation of

AES algorithm on FPGA. In Communications and Signal Processing (ICCSP), 2014 IEEE

International Conference on (pp. 1895-1899).

 Nadeem, H (2006). A performance comparison of data encryption algorithms," IEEE

Information and Communication Technologies, (pp. 84-89).

You might also like