Swapnil (Black Book) FULL
Swapnil (Black Book) FULL
Swapnil (Black Book) FULL
PROJECT REPORT
ON
“Encryption and Decryption System”
UNDER THE PARTIAL FULFILMENT OF UNIVERSITY OF
MUMBAI REQUIREMENT FOR THE COURSE OF
TYBSC(COMPUTER SCIENCE)
-: SUBMITTED BY :-
UNIVERSITY OF MUMBAI
2019-2020
1
CERTIFICATE
College seal
Declaration
I , Swapnil Narad, student of VPM R.Z. Shah College of Arts, Science &
Commerce Mithagar Road, Mulund(E), Mumbai-81, studying in TY BSC
COMPUTER SCIENCE hereby declare that I have completed this project on
Date:
Place:
3
INDEX
Sr.no. Title Page No.
01 Acknowledgement 5
02 Overview 6
2.1 Abstract 6
2.2 Undertaking 7
2.3 Objective 8
2.4 Scope 9
2.5 Introduction 10
03 System Design 14
04 TABLE STRUCTURE 18
05 Code Implementation 19
06 Results 38
07 Conclusion 42
4
ACKNOWLEDGEMENT
We take this occasion to thank God, almighty for blessing us with his
advice at the crucial junctures and for showing us the right way.
this occasion.
Last but not the least, I would like to thank friends and family for the
work.
5
ABSTRACT
This project encrypts and decrypts the all files by using RSA algorithm. Our aim is
that encrypts
and decrypts the textual files by using DES algorithm. Encryption and Decryption
is a strong all file encryption software for personal and professional security. It
protects privacy of our email messages, documents, photo, video, audio and
sensitive files by encrypting them using DES algorithm to provide high protection
through emails, e-commerce, etc. through internet. Sending sensitive messages over
the Internet is very dangerous. If you need to send sensitive messages over the
Internet, you should send it in the encrypted form. Encryption and Decryption
allows you easily encrypt and decrypt your messages. If you need to send sensitive
information via email, simply paste the encrypted text into your email and all the
6
UNDERTAKING
All the analysis design and System developed have been accomplished by
the
undersigned. Moreover, this project has not been submitted to any other
College or University.
7
OBJECTIVE
The main objective of our project is to encrypt/decrypt the all files for personal
photo, video, audio and sensitive files by encrypting them using DES algorithm
of information around the world. People use emails to correspond with one another
.The www is used for online business, data distribution, marketing, research,
Sending sensitive messages over the Internet is very dangerous as all emails are
transmitted in an unsecured form and anybody - ISP, your boss, etc. can read your
emails.
If you want to send sensitive information via email, simply paste the encrypted
file into your email or attach the encrypted file,all the recipient has to do is to
decrypt your text or file.Encryption and Decryption works with text information
and files. Just select what you want to encrypt, and Encryption and Decryption
confidential way.
8
SCOPE
The scope of our project is presently specific.Both the sender and the receiver
confidential.
Each step is clearly stated and user will not face any ambiguity in using the
software.
No complexity is involved.
9
INTRODUCTION
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/decompressthe files transmitted between them.This includes all the users
who want to interact electronically, whether it is through emails, e-
commerce,email messages, documents, photo, video, audio and sensitive
filesetc.through internet in order to keep their private information confidential.The
key elements of our website include the objectives, plus the following
Advantages :-
can be made public. Anyone can use the public key to encrypt a
decrypt it.
10
REQUIREMENT SPECIFICATION
NON-FUCTIONAL REQUIREMENT :-
Performance Requirements :
specification plays an important part in the analysis of the system, which will fit into
required environment. It rests largely with the users of the system to give the requirement
specifications because they are the people who finally use the system. This is because the
requirements have to be known during the initial stage so that the system can be designed
according to those requirements. It is Very difficult to change the system once it has been
designed and on the other hand designing a system, which does not cater to the
requirements of the user, is of no use. The requirement Specification for any system can
Reliability
Security
11
The Database should be protected from hacking, virus etc.
Availability
FEASIBLITY STUDY
accomplish its task on the working grounds. Its impact was also found to be not
adverse. It was found that the user’s requirements would be met and the resources
related to the project were considered like the problem definition and the process
for solution. The cost and benefit analysis was also done.
*Feasibility Considerations
To do a feasibility study, the economic, technical and behavioral factors in the
12
Economic Feasibility
The project developed, Encryption and Decryption was within budget and
three 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 didn’t overdo
the outputs.
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 s/w being
installed.The project thus was technically feasible. The equipment and the
The project could be made to work correctly, fulfilling its task, with the
Operational Feasibility
users. The system developing has an influence on its users. Our system
“Encryption and Decryption” was new for them but it was simple enough for
13
any naïve 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
SYSTEM DESIGN
E-R DIAGRAM :-
14
CLASS DIAGRAM :-
15
16
USE CASE DIAGRAM :-
17
SYSTEM FLOW CHART
18
TABLE STRUCTURE:
ADMIN :
COLUMN DATATYPE
username Char(20)
password Varchar(20)
USER :
COLUMN DATATYPE
name Char(20)
username Char(20)
email Varchar(20)
phone Number(10)
password Varchar(20)
19
CODE :-
Decryptor.java:
package encrypt;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
/**
*
* @author user
*/
public class Decryptor {
private static Decryptordecrypter = new
Decryptor();
private Decryptor()
{
}
public static
DecryptorgetDecrypter(booleanoriginalFile
Deleted)
{
deleteOriginal = originalFileDeleted;
return decrypter;
}
20
return;
try
{
if (!src.isDirectory())
{
copyDecrypted(src,
dst);
} else
{
File[] files =
src.listFiles();
System.out.println("Decryting...");
copyDecrypted(f, dst);
if(deleteOriginal) f.delete();
}
System.out.println(files.length + "
files are decrytped");
}
} catch (IOException e)
{
e.printStackTrace();
}
}
try
21
{
is = new
FileInputStream(source);
os = new
FileOutputStream(dest.getPath().concat("/").
concat(fileName));
int length;
while ((length =
is.read(buffer)) > 0)
{
decryptBytes(buffer);
os.write(buffer, 0,
length);
}
} finally
{
is.close();
os.close();
}
}
22
char c = (char) ((data[i * 2]
<< 8) | data[i * 2 + 1]);
res.append(c);
}
return res.toString();
}
try
{
dest = new
File(dest.getPath().concat("/").concat(source
.getName()));
is = new
FileInputStream(source);
os = new
FileOutputStream(dest);
int length;
int tl = 0;
23
while ((length =
is.read(buffer)) > 0)
{
tl += length;
os.write(buffer, 0,
length);
}
System.out.println(tl + "
bytes");
} finally
{
is.close();
os.close();
}
}
Encryptor.java
package encrypt;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.util.Random;
new Encryptor();
private Encryptor()
{
}
24
public static
EncryptorgetEncrypter(booleanoriginalFile
Deleted)
{
deleteOriginal = originalFileDeleted;
return encrypter;
}
try
{
if (!src.isDirectory())
{
copyEncrypted(src,
dst);
} else
{
File[] files =
src.listFiles();
System.out.println("Encrypting...");
copyEncrypted(f, dst);
if(deleteOriginal) f.delete();
}
System.out.println(files.length + "
files are encrypted");
25
}
} catch (IOException e)
{
e.printStackTrace();
}
}
dest = new
File(dest.getPath().concat("/").concat(getRa
ndomName(10, "sopiro")));
try
{
is = new
FileInputStream(source);
os = new
FileOutputStream(dest);
os.write(stringToByte(source.getNa
me()));
int length;
while ((length =
is.read(buffer)) > 0)
{
encryptBytes(buffer);
os.write(buffer, 0,
length);
26
}
} finally
{
is.close();
os.close();
}
}
return res;
}
27
{
char c = 'a';
int width = 'z' - 'a';
if (r.nextInt(3) == 0)
{
c = 'A';
width = 'Z' - 'A';
}
if (r.nextInt(3) == 1)
{
c = '0';
width = '9' - '0';
}
res.append((char) (c +
r.nextInt(width)));
}
res.append(".").append(extend);
return res.toString();
}
try
{
dest = new
File(dest.getPath().concat("/").concat(source
.getName()));
is = new
FileInputStream(source);
os = new
FileOutputStream(dest);
28
byte[] buffer = new
byte[1024];
int length;
int tl = 0;
while ((length =
is.read(buffer)) > 0)
{
tl += length;
os.write(buffer, 0,
length);
}
System.out.println(tl + "
bytes");
} finally
{
is.close();
os.close();
}
}
}
Main.java
/*
.
package encrypt;
import java.io.File;
29
// File dst = new File("C:\\dst");
en.encrypt(src,src);
//de.decrypt(src, src);
}
}
Login.java
package securityz;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Statement;
import javax.swing.JOptionPane;
public Login() {
initComponents();
}
setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
30
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());
jLabel2.setIcon(new
javax.swing.ImageIcon(getClass().getResource("/securityz/Images/download.png"))); // NOI18N
jLabel2.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel2.text"));
// NOI18N
jPanel1.add(jLabel2, new org.netbeans.lib.awtextra.AbsoluteConstraints(3, -2, 60, 50));
31
jLabel6MouseClicked(evt);
}
});
password.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.password.text")); //
NOI18N
userName.setText(org.openide.util.NbBundle.getMessage(Login.class,
"Login.userName.text")); // NOI18N
userName.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEventevt) {
userNameActionPerformed(evt);
}
});
32
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(userName, javax.swing.GroupLayout.DEFAULT_SIZE, 189,
Short.MAX_VALUE)
.addComponent(password))
.addContainerGap())
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(87, 87, 87)
.addComponent(jLabel7)
.addContainerGap(144, Short.MAX_VALUE))
);
jPanel2Layout.setVerticalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(66, 66, 66)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jLabel3, javax.swing.GroupLayout.PREFERRED_SIZE, 26,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(userName, javax.swing.GroupLayout.PREFERRED_SIZE, 33,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(21, 21, 21)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jLabel4, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(password, javax.swing.GroupLayout.PREFERRED_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(42, 42, 42)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE
)
.addComponent(jLabel5)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 24,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(36, 36, 36)
.addComponent(jLabel7)
.addContainerGap(55, Short.MAX_VALUE))
);
33
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 49,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
);
pack();
}// </editor-fold>
System.out.println(rs.getString(1));
if(rs.getString(2).equals(userName.getText())|
rs.getString(3).equals(password.getText())){
34
this.dispose();
new NewJFrame().setVisible(true);
PreparedStatementpStmt = con.prepareStatement("insert into signin_info values(status) "+"(?)");
pStmt.setInt(1, 1);
i=1;
uName= rs.getString(1);
uUserName=rs.getString(2);
uEmail=rs.getString(4);
uPassword=rs.getString(3);
break;
}
}
if(i==0)
JOptionPane.showMessageDialog(this, "username or password is wrong");
}
catch(Exception e){
System.out.println(e.getMessage()+""+e.getStackTrace()+""+e);
}
}
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(java.util.logging.Level.SEVERE,
null, ex);
} catch (InstantiationException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (IllegalAccessException ex) {
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
} catch (javax.swing.UnsupportedLookAndFeelException ex) {
35
java.util.logging.Logger.getLogger(Login.class.getName()).log(java.util.logging.Level.SEVERE,
null, ex);
}
//</editor-fold>
SecurityZ.java
package securityz;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
36
Login l =new Login();
l.setVisible(true);
}
SigninCheck.java
package securityz;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
if(userName.equals("")){
i= 1;
}
else if(password.equals(""))
i=2;
else if(password.equals(confirmPassword))
i= 4;
else
i= 3;
System.out.println(i);
return i;
}
public int validUserName(String userName){
int i=0;
try{
Class.forName("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/security-
z","root","");
System.out.println("lakshay10");
37
Statement stmt=con.createStatement();
ResultSetrs =stmt.executeQuery("select * from signin_info");
while(rs.next()){
System.out.println(rs.getString(1));
if(userName.equals(rs.getString(2)))
return 0;
else
i=1;
}
}
catch(Exception e){
System.out.println(e.getMessage()+""+e.getStackTrace()+""+e);
}
return i;
}
}
SCREENSHOTS
Signin:Login:
38
Home:
Encryption:
39
Decryption:Setting:
40
Learning:
Change Password:
41
User profile setting:
42
CONCLUSION
After implementing the system in the market its advantages were incomparable to
the present contemporary systems available in the market. The most admirable
feature founded was its simplicity in terms of application to the user but its highly
beneficial outputs can’t be ignored. The users will be highly benefited after using
the system.
Goals achieved: Following are the goals achieved in designing and implementing
the system.
User Friendliness: The system is user friendly as any naïve user can use it and
easily understand its functionality.
Future Plans: The system is adaptable to the future changes if any are deployed.
43
REFERENCES
1. www.google.com
a. http://en.wikipedia.org/wiki/RSA_algorithm
b. “Data Communications and Networking”, 4th Edition, by Behrouz A.
c. Forouzan, Tata McGraw Hill
3. www.youtube.com
http://crypto.cs.mcgill.ca/~crepeau/RSA/generator_frame.htmlRSA Patent
info : www.rsasecurity.com/rsalabs/node
44
45