0% found this document useful (0 votes)
23 views29 pages

OOT Project Report Sample Format

Uploaded by

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

OOT Project Report Sample Format

Uploaded by

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

“Encryption and Decryption”

A Report Submitted
In Partial Fulfillment
for award of Bachelor of Technology

In
CSE(Data Science)
By

AYUSH KUMAR (Roll No. 2301331540048)

Prof. (Dr.) Mr. Raviraj Singh


CSE (Data Science)

DECLARATION

I hereby declare that the work presented in this report was carried out by me. I have not
submitted the matter embodied in this report for the award of any other degree or diploma of
any other University or Institute.

Name : Ayush Kumar


Roll Number : 2301331540048
Candidate Signature :
Ayushkr

i
CSE (Data Science)

CERTIFICATE

Certified that Ayush Kumar (Roll No: 2301331540048), has carried out the industrial work

presented in this Project Report at <Noida Institute Of Engineering and Technology>in

partial fulfillment of the requirements for the award of Bachelor of Technology, department

name from Dr. APJ Abdul Kalam Technical University, Lucknow under our supervision.

Signature Signature

(Name of Institutional Supervisor) (Name of HOD)

(Designation) (Designation)
(Department) (Department)
NIET Greater Noida NIET Greater Noida

Date:

ii
CSE (Data Science)

ACKNOWLEDGEMENT
<Times New Roman, font size 14>

I would like to express my gratitude towards <Mr. Raviraj Singh> for their guidance, support
and constant supervision as well as for providing necessary information during my internship.

My thanks and appreciations to respected HOD, for their motivation and support throughout.

iii
CSE (Data Science)

iv
CSE (Data Science)

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

v
CSE (Data Science)

TABLE OF CONTENTS
Page No.
Declaration i
Certificate from the institute ii
Certificate from the industry iii
Acknowledgement iv
Abstract v
CHAPTER 1: INTRODUCTION 1-12
1.1 INTRODUCTION
1.1.1
1.1.2
1.1.2.1
1.1.2.2
1.1.2.3
1.2 OBJECTIVE AND SCOPE

………………
CHAPTER 2: Code 13-20

CHAPTER 3: Output 21-15

CHAPTER 4: CONCLUSION AND FUTURE WORK 36-37


REFERENCES 38
APPENDICES 39-42

1
CSE (Data Science)

CHAPTER 1

INTRODUCTION

1.1Overview:

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 Java Cryptography Architecture (JCA) within the
JDK.

1.2 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.3 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
CSE (Data Science)

2
CSE (Data Science)

CHAPTER 2

Code

package ecryptiondecryption;

import java.awt.Frame;

import java.awt.Toolkit;

import java.awt.datatransfer.StringSelection;

import java.io.UnsupportedEncodingException;

import java.security.MessageDigest;

import java.security.NoSuchAlgorithmException;

import java.util.Arrays;

import java.util.Base64;

import javax.crypto.Cipher;

import javax.crypto.spec.SecretKeySpec;

public class source extends javax.swing.JFrame {

/**

* Creates new form EncryptDecrypt

*/

private static SecretKeySpec secretKey;

private static byte[] key;

public static void setKey(String myKey)

MessageDigest sha = null;

3
CSE (Data Science)

try {

key = myKey.getBytes("UTF-8");

sha = MessageDigest.getInstance("SHA-1");

key = sha.digest(key);

key = Arrays.copyOf(key, 16);

secretKey = new SecretKeySpec(key, "AES");

catch (NoSuchAlgorithmException e) {

e.printStackTrace();

catch (UnsupportedEncodingException e) {

e.printStackTrace();

public source() {

initComponents();

@SuppressWarnings("unchecked")

private void initComponents() {

jScrollPane1 = new javax.swing.JScrollPane();

text1 = new javax.swing.JTextArea();

jScrollPane2 = new javax.swing.JScrollPane();

text2 = new javax.swing.JTextArea();

jScrollPane3 = new javax.swing.JScrollPane();

text3 = new javax.swing.JTextArea();

jScrollPane4 = new javax.swing.JScrollPane();

text4 = new javax.swing.JTextArea();

msg1 = new javax.swing.JTextField();

msg2 = new javax.swing.JTextField();

4
CSE (Data Science)

encrypt = new javax.swing.JButton();

decrypt = new javax.swing.JButton();

copyencrypt = new javax.swing.JButton();

copydecrypt = new javax.swing.JButton();

jLabel2 = new javax.swing.JLabel();

jLabel3 = new javax.swing.JLabel();

jLabel1 = new javax.swing.JLabel();

jLabel4 = new javax.swing.JLabel();

jLabel5 = new javax.swing.JLabel();

jLabel6 = new javax.swing.JLabel();

message1 = new javax.swing.JLabel();

message2 = new javax.swing.JLabel();

mainsection = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

setTitle("Encryption and Decryption ");

setAlwaysOnTop(true);

setUndecorated(true);

setResizable(false);

getContentPane().setLayout(null);

text1.setBackground(new java.awt.Color(255, 255, 255));

text1.setColumns(20);

text1.setFont(new java.awt.Font("Dialog", 0, 14));

text1.setForeground(new java.awt.Color(0, 0, 0));

text1.setRows(5);

text1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102),


2));

jScrollPane1.setViewportView(text1);

getContentPane().add(jScrollPane1);

jScrollPane1.setBounds(80, 80, 300, 120);

5
CSE (Data Science)

text2.setBackground(new java.awt.Color(255, 255, 255));

text2.setColumns(20);

text2.setFont(new java.awt.Font("Dialog", 0, 14));

text2.setForeground(new java.awt.Color(0, 0, 0));

text2.setRows(5);

text2.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102),


2));

jScrollPane2.setViewportView(text2);

getContentPane().add(jScrollPane2);

jScrollPane2.setBounds(80, 322, 300, 120);

text3.setBackground(new java.awt.Color(255, 255, 255));

text3.setColumns(20);

text3.setFont(new java.awt.Font("Dialog", 0, 14));

text3.setForeground(new java.awt.Color(0, 0, 0));

text3.setRows(5);

text3.setToolTipText("");

text3.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102),


2));

jScrollPane3.setViewportView(text3);

getContentPane().add(jScrollPane3);

jScrollPane3.setBounds(470, 80, 320, 120);

text4.setBackground(new java.awt.Color(255, 255, 255));

text4.setColumns(20);

text4.setFont(new java.awt.Font("Dialog", 0, 14));

text4.setForeground(new java.awt.Color(0, 0, 0));

text4.setRows(5);

text4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102, 102),


2));

6
CSE (Data Science)

jScrollPane4.setViewportView(text4);

getContentPane().add(jScrollPane4);

jScrollPane4.setBounds(470, 320, 320, 120);

msg1.setBackground(new java.awt.Color(255, 255, 255));

msg1.setForeground(new java.awt.Color(0, 0, 0));

msg1.setHorizontalAlignment(javax.swing.JTextField.CENTER);

getContentPane().add(msg1);

msg1.setBounds(200, 220, 180, 30);

msg2.setBackground(new java.awt.Color(255, 255, 255));

msg2.setForeground(new java.awt.Color(0, 0, 0));

msg2.setHorizontalAlignment(javax.swing.JTextField.CENTER);

getContentPane().add(msg2);

msg2.setBounds(595, 220, 190, 30);

encrypt.setBackground(new java.awt.Color(0, 51, 51));

encrypt.setFont(new java.awt.Font("Dialog", 1, 14));

encrypt.setForeground(new java.awt.Color(255, 255, 255));

encrypt.setText("Encrypt");

encrypt.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

encryptActionPerformed(evt);

});

getContentPane().add(encrypt);

encrypt.setBounds(80, 275, 90, 30);

decrypt.setBackground(new java.awt.Color(0, 51, 51));

decrypt.setFont(new java.awt.Font("Dialog", 1, 14));

decrypt.setForeground(new java.awt.Color(255, 255, 255));

7
CSE (Data Science)

decrypt.setText("Decrypt");

decrypt.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

decryptActionPerformed(evt);

});

getContentPane().add(decrypt);

decrypt.setBounds(470, 275, 90, 30);

copyencrypt.setBackground(new java.awt.Color(102, 0, 0));

copyencrypt.setFont(new java.awt.Font("Dialog", 1, 12));

copyencrypt.setForeground(new java.awt.Color(255, 255, 255));

copyencrypt.setText("Copy Encryption");

copyencrypt.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

copyencryptActionPerformed(evt);

});

getContentPane().add(copyencrypt);

copyencrypt.setBounds(240, 275, 140, 30);

copydecrypt.setBackground(new java.awt.Color(102, 0, 0));

copydecrypt.setFont(new java.awt.Font("Dialog", 1, 12));

copydecrypt.setForeground(new java.awt.Color(255, 255, 255));

copydecrypt.setText("Copy Decryption");

copydecrypt.addActionListener(new java.awt.event.ActionListener() {

public void actionPerformed(java.awt.event.ActionEvent evt) {

copydecryptActionPerformed(evt);

});

getContentPane().add(copydecrypt);

copydecrypt.setBounds(633, 275, 150, 30);

8
CSE (Data Science)

jLabel2.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

jLabel2.addMouseListener(new java.awt.event.MouseAdapter() {

public void mousePressed(java.awt.event.MouseEvent evt) {

jLabel2MousePressed(evt);

});

getContentPane().add(jLabel2);

jLabel2.setBounds(810, 5, 30, 20);

jLabel3.setCursor(new java.awt.Cursor(java.awt.Cursor.HAND_CURSOR));

jLabel3.addMouseListener(new java.awt.event.MouseAdapter() {

public void mousePressed(java.awt.event.MouseEvent evt) {

jLabel3MousePressed(evt);

});

getContentPane().add(jLabel3);

jLabel3.setBounds(780, 5, 30, 20);

jLabel1.setFont(new java.awt.Font("Dialog", 1, 14));

jLabel1.setForeground(new java.awt.Color(204, 51, 0));

jLabel1.setText("Encryption Key");

jLabel1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel1.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102,


102)));

getContentPane().add(jLabel1);

jLabel1.setBounds(80, 220, 120, 30);

jLabel4.setFont(new java.awt.Font("Dialog", 1, 14));

jLabel4.setForeground(new java.awt.Color(204, 51, 0));

jLabel4.setText("Decryption Key");

jLabel4.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

9
CSE (Data Science)

jLabel4.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(102, 102,


102)));

getContentPane().add(jLabel4);

jLabel4.setBounds(470, 220, 120, 30);

jLabel5.setFont(new java.awt.Font("Dialog", 1, 18));

jLabel5.setForeground(new java.awt.Color(0, 0, 51));

jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel5.setText("Message to Decrypt");

getContentPane().add(jLabel5);

jLabel5.setBounds(470, 50, 300, 30);

jLabel6.setFont(new java.awt.Font("Dialog", 1, 18));

jLabel6.setForeground(new java.awt.Color(0, 0, 51));

jLabel6.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

jLabel6.setText("Message to Encrypt ");

getContentPane().add(jLabel6);

jLabel6.setBounds(80, 50, 300, 30);

message1.setForeground(new java.awt.Color(204, 0, 0));

message1.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

getContentPane().add(message1);

message1.setBounds(80, 450, 300, 20);

message2.setForeground(new java.awt.Color(204, 0, 0));

message2.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);

getContentPane().add(message2);

message2.setBounds(470, 450, 320, 20);

mainsection.setForeground(new java.awt.Color(153, 0, 0));

mainsection.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/edcrypt.png")));

mainsection.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));

10
CSE (Data Science)

getContentPane().add(mainsection);

mainsection.setBounds(0, 0, 850, 500);

setSize(new java.awt.Dimension(850, 499));

setLocationRelativeTo(null);

private void jLabel2MousePressed(java.awt.event.MouseEvent evt) {

System.exit(0);

private void jLabel3MousePressed(java.awt.event.MouseEvent evt) {

this.setState(Frame.ICONIFIED);

private void encryptActionPerformed(java.awt.event.ActionEvent evt) {

String strToEncrypt;

String secret;

try

strToEncrypt=text1.getText();

secret=msg1.getText();

setKey(secret);

Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");

cipher.init(Cipher.ENCRYPT_MODE, secretKey);

text2.setText(Base64.getEncoder().encodeToString(cipher.doFinal(strToEncrypt.getBytes("UTF-
8"))));

11
CSE (Data Science)

catch (Exception e)

text2.setText("Please fill up the right secret key");

private void copyencryptActionPerformed(java.awt.event.ActionEvent evt) {

Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new
StringSelection(text2.getText()),null);

message1.setText("Your encryption result is copied!");

message2.setText("");

private void decryptActionPerformed(java.awt.event.ActionEvent evt) {

String secret;

String strToDecrypt;

try

secret=msg2.getText();

strToDecrypt=text3.getText();

setKey(secret);

Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5PADDING");

cipher.init(Cipher.DECRYPT_MODE, secretKey);

text4.setText(new String(cipher.doFinal(Base64.getDecoder().decode(strToDecrypt))));

catch (Exception e)

text4.setText("Please fill up the right secret key");

12
CSE (Data Science)

private void copydecryptActionPerformed(java.awt.event.ActionEvent evt) {

Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new
StringSelection(text4.getText()),null);

message2.setText("Your decryption result is copied!");

message1.setText("");

public static void main(String args[]) {

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(source.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (InstantiationException ex) {

java.util.logging.Logger.getLogger(source.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (IllegalAccessException ex) {

java.util.logging.Logger.getLogger(source.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

} catch (javax.swing.UnsupportedLookAndFeelException ex) {

java.util.logging.Logger.getLogger(source.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);

java.awt.EventQueue.invokeLater(new Runnable() {

public void run() {

new source().setVisible(true);

13
CSE (Data Science)

});

private javax.swing.JButton copydecrypt;

private javax.swing.JButton copyencrypt;

private javax.swing.JButton decrypt;

private javax.swing.JButton encrypt;

private javax.swing.JLabel jLabel1;

private javax.swing.JLabel jLabel2;

private javax.swing.JLabel jLabel3;

private javax.swing.JLabel jLabel4;

private javax.swing.JLabel jLabel5;

private javax.swing.JLabel jLabel6;

private javax.swing.JScrollPane jScrollPane1;

private javax.swing.JScrollPane jScrollPane2;

private javax.swing.JScrollPane jScrollPane3;

private javax.swing.JScrollPane jScrollPane4;

private javax.swing.JLabel mainsection;

private javax.swing.JLabel message1;

private javax.swing.JLabel message2;

private javax.swing.JTextField msg1;

private javax.swing.JTextField msg2;

private javax.swing.JTextArea text1;

private javax.swing.JTextArea text2;

private javax.swing.JTextArea text3;

private javax.swing.JTextArea text4;

14
CSE (Data Science)

CHAPTER 3

Output

15
CSE (Data Science)

16
CSE (Data Science)

17
CSE (Data Science)

18
CSE (Data Science)

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).
 “AES Website”,
https://en.wikipedia.org/wiki/Advanced_Encryption_Standard
 “Java Website”,
http://www.en.wikipedia.org/wiki/Java_(programming_language)
 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).
 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).
19
CSE (Data Science)

20
CSE (Data Science)

21
CSE (Data Science)

22

You might also like