Sie sind auf Seite 1von 45

A

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 :-

MR. SWAPNIL GANESH NARAD


-: GUIDED BY :-

Prof. Nisha Kothawade

DEPARTMENT OF COMPUTER SCIENCE


V.P.M’S R.Z. SHAH SCIENCE,COMMERCE
AND ARTS COLLEGE
MULUND(EAST), MUMBAI-400-081

UNIVERSITY OF MUMBAI
2019-2020

1
CERTIFICATE

This is to certify that the project entitled “Encryption And


Decryption System”Undertaken at the VPM’s R.Z. Shah College of
Arts , Science and Commerceby Mr. Swapnil Ganesh Narad
Seat no. 1952023 in partial fulfillment of B.Sc. CS degree
(Semester- V) Examination had not been submitted for any other
examination and does not form part of any other course undergone
by the candidate.
It is further certified that he has completed all required phases of the
project.

Signature of Internal Guide Signature


HOD/In-charege/Coordinator

Signature of the External Signature of the Principal

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

“Encryption And Decryption System”during the academic year 2019-2020.

The information submitted is true and original to the best of my knowledge.

Date:

Place:

Swapnil Ganesh Narad


BSC (COMPUTER SCIENCE)

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

2.6 Requirement Specification 11

2.7 Feasibility Study 12

03 System Design 14

3.1 E-R Diagram 14

3.2 Class Diagram 15

3.3 Use Case Diagram 16

3.4 System Flow Chart 17

04 TABLE STRUCTURE 18

05 Code Implementation 19

06 Results 38

6.1 Screen Shots 38

07 Conclusion 42

08 Reference and Bibliography 43

4
ACKNOWLEDGEMENT

We take this occasion to thank God, almighty for blessing us with his

grace and taking our endeavour to a successful culmination. We extend

our sincere and heart felt thanks to our esteemed guided,

Mrs.NISHAKOTHAWADEfor providing us with rightguidance and

advice at the crucial junctures and for showing us the right way.

I also take this opportunity to thank Head of the Department

Mrs.RAJSHRIPRABHU, for allowing us to use the facilities

available. We would like to thank the other faculty members also, at

this occasion.

Last but not the least, I would like to thank friends and family for the

support and encouragement they have given me during this course of

work.

5
ABSTRACT

The title of our project is “ENCRYPTION AND DECRYPTION SYSTEM”.

This project encrypts and decrypts the all files by using RSA algorithm. Our aim is

to develop the software named ENCRYPTION AND DECRYPTION SYSTEM

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

against unauthorized data access.

Every day hundreds and thousands of people interact electronically, whether it is

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

recipients has to do is to decrypt the file.

6
UNDERTAKING

This is to declare that the project entitled “ENCRYPTION AND


DECRYPTION SYSTEM” is an original work done by the
undersigned, in partial
fulfilment of the requirement for the degree “ Bachelor of Science in
Computer Science ” at CS Department, VPM’s R Z Shah College of
Arts Science and Commerce.

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

and professional security.

Encryption and Decryption protects privacy of our email messages, documents,

photo, video, audio and sensitive files by encrypting them using DES algorithm

to provide high protection against unauthorized data access.

The Internet is comprised of millions of interconnected communication and transfer

of information around the world. People use emails to correspond with one another

.The www is used for online business, data distribution, marketing, research,

learning and a myriad of other activities.

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

software helps you keep documents, private information and files in a

confidential way.

8
SCOPE

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.This includes all the

users who want to interact electronically, whether it is through emails,

ecommerce, etc.through internet in order to keep their private information

confidential.

 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 naïve users.

 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 :-

 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 two different keys (a key pair) for encryption and decryption.

 These algorithms are called "public-key" because the encryption key

can be made public. Anyone can use the public key to encrypt a

message, butonly the owner of the corresponding private key can

decrypt it.

10
REQUIREMENT SPECIFICATION

NON-FUCTIONAL REQUIREMENT :-

Performance Requirements :

Performance is measured in terms of the output provided by the application. Requirement

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

be broadly stated as given below :

• The system should be interface with the user

Reliability

• In this system reliability means the

Security

11
 The Database should be protected from hacking, virus etc.

Availability

 This application will be available always

FEASIBLITY STUDY

After investigation it is essential to determine whether the project is feasible or not.

In feasibility study is tested whether the system to be developed would be able to

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

would be used in an effective manner. In feasibility study the important aspects

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

system development were considered.

The three key considerations were as follows:

12
Economic Feasibility

The project developed, Encryption and Decryption was within budget and

producing the desired results.Thelabor or the human ware consisted of the

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

s/w produced no problem. The project’s technical requirements were met.

The project could be made to work correctly, fulfilling its task, with the

existing s/w and personnel.

Operational Feasibility

Operational Feasibility aims to determine the impact of the system on the

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

complexities would be involved in its functionalities.

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 static booleandeleteOriginal;

private Decryptor()
{
}

public static
DecryptorgetDecrypter(booleanoriginalFile
Deleted)
{
deleteOriginal = originalFileDeleted;

return decrypter;
}

public void decrypt(File src, File dst)


{
if (!dst.exists())
dst.mkdir();
if (!dst.isDirectory())

20
return;

try
{
if (!src.isDirectory())
{
copyDecrypted(src,
dst);
} else
{
File[] files =
src.listFiles();

System.out.println("Decryting...");

for (File f : files)


{

copyDecrypted(f, dst);

if(deleteOriginal) f.delete();
}

System.out.println(files.length + "
files are decrytped");
}
} catch (IOException e)
{
e.printStackTrace();
}
}

public void copyDecrypted(File source, File


dest) throws IOException
{
InputStream is = null;
OutputStreamos = null;

try

21
{
is = new
FileInputStream(source);

byte[] buffer = new


byte[1024];

byte[] name = new


byte[is.read() * 2];
is.read(name);
String fileName =
bytesToString(name);

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();
}
}

public String bytesToString(byte[] data)


{
StringBuilder res = new
StringBuilder();

for (int i = 0; i<data.length / 2; i++)


{

22
char c = (char) ((data[i * 2]
<< 8) | data[i * 2 + 1]);
res.append(c);
}

return res.toString();
}

private void decryptBytes(byte[] data) //


Decryption Algorithm is written into here
{
for (int i = 0; i<data.length; i++)
{
data[i] = (byte) ~data[i];
}
}

public void copy(File source, File dest)


throws IOException
{
InputStream is = null;
OutputStreamos = null;

try
{
dest = new
File(dest.getPath().concat("/").concat(source
.getName()));

is = new
FileInputStream(source);
os = new
FileOutputStream(dest);

byte[] buffer = new


byte[1024];

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 static booleandeleteOriginal;

private Encryptor()
{
}

24
public static
EncryptorgetEncrypter(booleanoriginalFile
Deleted)
{
deleteOriginal = originalFileDeleted;

return encrypter;
}

public void encrypt(File src, File dst)


{
if (!dst.exists())
dst.mkdir();
if (!dst.isDirectory())
return;

try
{
if (!src.isDirectory())
{
copyEncrypted(src,
dst);
} else
{
File[] files =
src.listFiles();

System.out.println("Encrypting...");

for (File f : files)


{

copyEncrypted(f, dst);

if(deleteOriginal) f.delete();
}

System.out.println(files.length + "
files are encrypted");

25
}
} catch (IOException e)
{
e.printStackTrace();
}
}

public void copyEncrypted(File source, File


dest) throws IOException
{
InputStream is = null;
OutputStreamos = null;

dest = new
File(dest.getPath().concat("/").concat(getRa
ndomName(10, "sopiro")));

try
{
is = new
FileInputStream(source);
os = new
FileOutputStream(dest);

os.write(new byte[] { (byte)


source.getName().length() });

os.write(stringToByte(source.getNa
me()));

byte[] buffer = new


byte[1024];

int length;

while ((length =
is.read(buffer)) > 0)
{
encryptBytes(buffer);
os.write(buffer, 0,
length);

26
}

} finally
{
is.close();
os.close();
}
}

private void encryptBytes(byte[] data) //


Encryption Algorithm is written into here
{
for (int i = 0; i<data.length; i++)
{
data[i] = (byte) ~data[i];
}
}

public byte[] stringToByte(String data)


{
char[] ca = data.toCharArray();
byte[] res = new byte[ca.length * 2];
// Character.BYTES = 2;

for (int i = 0; i<res.length; i++)


{
res[i] = (byte) ((ca[i / 2] >> (8
- (i % 2) * 8)) & 0xff);
}

return res;
}

public String getRandomName(int length,


String extend)
{
Random r = new Random();
StringBuilder res = new
StringBuilder();

for (int i = 0; i< length; i++)

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();
}

public void copy(File source, File dest)


throws IOException
{
InputStream is = null;
OutputStreamos = null;

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;

public class Main {


public static void main(String[] args)
{
Encryptoren = Encryptor.getEncrypter(true);
Decryptor de = Decryptor.getDecrypter(true);

File src = new File("C:\\src\\back.png");

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 class Login extends javax.swing.JFrame {

public Login() {
initComponents();
}

jPanel1 = new javax.swing.JPanel();


jLabel1 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jPanel2 = new javax.swing.JPanel();
jLabel3 = new javax.swing.JLabel();
jLabel4 = new javax.swing.JLabel();
jLabel5 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
jLabel7 = new javax.swing.JLabel();
password = new javax.swing.JPasswordField();
userName = new javax.swing.JFormattedTextField();

setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

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

30
jPanel1.setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

jLabel1.setFont(new java.awt.Font("Adams", 0, 18)); // NOI18N


jLabel1.setForeground(new java.awt.Color(255, 255, 255));
jLabel1.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel1.text"));
// NOI18N
jPanel1.add(jLabel1, new org.netbeans.lib.awtextra.AbsoluteConstraints(60, 0, 242, 34));

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));

jPanel2.setBackground(new java.awt.Color(51, 51, 51));


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

jLabel3.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N


jLabel3.setForeground(new java.awt.Color(255, 255, 255));
jLabel3.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel3.text"));
// NOI18N

jLabel4.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N


jLabel4.setForeground(new java.awt.Color(255, 255, 255));
jLabel4.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel4.text"));
// NOI18N

jLabel5.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N


jLabel5.setForeground(new java.awt.Color(255, 255, 255));
jLabel5.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel5.text"));
// NOI18N
jLabel5.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEventevt) {
jLabel5MouseClicked(evt);
}
});

jLabel6.setFont(new java.awt.Font("Times New Roman", 0, 18)); // NOI18N


jLabel6.setForeground(new java.awt.Color(255, 255, 255));
jLabel6.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel6.text"));
// NOI18N
jLabel6.addMouseListener(new java.awt.event.MouseAdapter() {
public void mouseClicked(java.awt.event.MouseEventevt) {

31
jLabel6MouseClicked(evt);
}
});

jLabel7.setFont(new java.awt.Font("Tempus Sans ITC", 0, 18)); // NOI18N


jLabel7.setForeground(new java.awt.Color(255, 255, 255));
jLabel7.setText(org.openide.util.NbBundle.getMessage(Login.class, "Login.jLabel7.text"));
// NOI18N

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);
}
});

javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);


jPanel2.setLayout(jPanel2Layout);
jPanel2Layout.setHorizontalGroup(
jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
jPanel2Layout.createSequentialGroup()
.addGap(49, 49, 49)
.addComponent(jLabel6, javax.swing.GroupLayout.PREFERRED_SIZE, 58,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel5, javax.swing.GroupLayout.PREFERRED_SIZE, 50,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(54, 54, 54))
.addGroup(jPanel2Layout.createSequentialGroup()
.addGap(28, 28, 28)
.addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING,
false)
.addComponent(jLabel3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(jLabel4, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))

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))
);

javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());


getContentPane().setLayout(layout);

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>

private void jLabel6MouseClicked(java.awt.event.MouseEventevt) {


this.dispose();
Signin s = new Signin();
s.setVisible(true);
}

private void userNameActionPerformed(java.awt.event.ActionEventevt) {


// TODO add your handling code here:
}

private void jLabel5MouseClicked(java.awt.event.MouseEventevt) {


try{
int i=0;
Class.forName("com.mysql.jdbc.Driver");
Connection con =DriverManager.getConnection("jdbc:mysql://localhost:3306/security-
z","root","");
Statement stmt=con.createStatement();
ResultSetrs =stmt.executeQuery("select * from signin_info");
while(rs.next()){

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>

/* Create and display the form */


java.awt.EventQueue.invokeLater(new Runnable() {
public void run() {
new Login().setVisible(true);
}
});
}
static String uUserName="";
static String uName="";
static String uEmail="";
static String uPassword="";
// Variables declaration - do not modify
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.JLabel jLabel7;
private javax.swing.JPanel jPanel1;
private javax.swing.JPanel jPanel2;
private javax.swing.JPasswordField password;
private javax.swing.JFormattedTextFielduserName;
// End of variables declaration
}

SecurityZ.java

package securityz;

public class 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;

public class SigninCheck {


public int ValidAll(String userName,Stringpassword,StringconfirmPassword){
int i=0;

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.

Security: Security is enabled as certain features and functionalities are restricted to


the registered users only and also at other levels security is implemented.

Fast: The system aims to respond to the user as fast as possible.

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

2. Roger S.Pressman,” Software Engineering A Practitioners Approach”,

McGraw Hill, 1992, p.p.207-237.

3. www.youtube.com

4. E Balagurusamy,” Programming with JAVA”, McGraw Hill,2003.

5. William Stalings,”Cryptography and Network Security”.

6. DES Key Generator for default keys used:

http://crypto.cs.mcgill.ca/~crepeau/RSA/generator_frame.htmlRSA Patent

info : www.rsasecurity.com/rsalabs/node

44
45

Das könnte Ihnen auch gefallen