Ajp Micro-Project

Download as pdf or txt
Download as pdf or txt
You are on page 1of 11

SOLAPUR EDUCATION SOCIETY’S

S.E.S. POLYTECHNIC, SOLAPUR


Samrat Chowk, Solapur

CERTIFICATE
This is to certify that the Following students of Computer Department
1. Amoghsiddh Mhamane - 3504
2. Suyash Pujari - 3528
3. Nikhil Jain - 3501
4. Abhishek Bhosale - 3529
has satisfactorily completed micro-project titled Encryption and
Decryption GUI
in subject “Advanced Java Programming” (22517) as prescribed by
Maharashtra State Board of Technical Education, Mumbai. For the Fifth semester
(I-Scheme) of Diploma in Computer Technology in Academic Year 2021-22
Date: / 12 / 2021

Staff Incharge Head of Dept Principal

(Mrs.Trigule D.J.) (Mr.Patil M.C) (Bhavtankar A.A.)

S.E.S. Polytechnic, Solapur


Synopsis:
We created Encryption and Decryption Messenger GUI Using Server
Socket which in a way is an easiest way for Client and Server
Chatting, we had a view of developing a Messenger which can be
used for sending and receiving message securely, In This project we
developed a connection between the Headquarter and a Cop Who is
Far away from the Headquarter Using Server Socket the message is
sent and received in the form of Socket which made it easy the, we
used a unique algorithm for Encryption an Decryption which makes it
more tough for the Bisectors and Hackers for Decoding the text sent
and received , our algorithm creates an implicit firewall which can be
braked but it’s tough to and as it an GUI based application it is
convenient to use with minimal knowledge of Computers, This was a
brief introduction of our project.

Microproject – Course Outcome matrix


Course Outcomes:

a. Develop programs using GUI framework (AWT and Swing).


b. Handle events of AWT and Swings components.
c. Develop programs to handle events in java programming.
d. Develop java programs using networking concepts.
e. Develop programs using database.
f. Develop programs using servlets

Sr.No MICRO-PROJECT TOPIC CO CO CO CO CO CO


a b c d e f

1 Encryption and Decryption GUI ✓ ✓ ✓ ✓


Server_Application.java
import java.awt.*;

import java.net.*;

import java.awt.event.*;

import java.io.*;

class Server extends Frame implements ActionListener

Label l1;

TextField t1,t2,t3,t4;

TextArea ta;

Button b1,b2,b3,b4;

ServerSocket ss;

Socket s;

DataOutputStream dos;

DataInputStream dis;

Server()

setLayout(null);

l1=new Label("MH Headquarters");

add(l1);

l1.setBounds(300,50,400,45);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,40));

l1.setForeground(Color.red);

l1=new Label("Msg to Client:");

add(l1);

l1.setBounds(100,140,250,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForegroud(Color.red);

t3=new TextField(20);

add(t3);

t3.setBounds(350,150,200,30);

l1=new Label("Enter Key:");

add(l1);

l1.setBounds(100,200,250,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForeground(Color.red);

t4=new TextField(20);

add(t4);

t4.setBounds(350,200,200,30);

l1=new Label("Chat History : ");

add(l1);

l1.setBounds(100,250,250,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));
l1.setForeground(Color.red);

ta=new TextArea(10,30);

add(ta);

ta.setBounds(350,250,300,200);

b1=new Button("Start Server");

add(b1);

b1.setBounds(100,500,150,30);

b1.setFont(new Font("Cambria",Font.BOLD,15));

b1.addActionListener(this);

b2=new Button("Send");

add(b2);

b2.setBounds(260,500,100,30);

b2.setFont(new Font("Cambria",Font.BOLD,15));

b2.addActionListener(this);

b3=new Button("Receive");

add(b3);

b3.setBounds(380,500,100,30);

b3.setFont(new Font("Cambria",Font.BOLD,15));

b3.addActionListener(this);

b4=new Button("Clear");

add(b4);

b4.setBounds(500,500,100,30);

b4.setFont(new Font("Cambria",Font.BOLD,15));

b4.addActionListener(this);

public void actionPerformed(ActionEvent ae)

if(b1==ae.getSource())

try

ss=new ServerSocket(8888);

s=ss.accept();

ta.append("\nConnectionn is established");

catch(Exception e)

e.printStackTrace();

if(b2==ae.getSource())

try

dos=new DataOutputStream(s.getOutputStream());
String data=t3.getText().trim();

int k=Integer.parseInt(t4.getText());

int len=data.length();

String en=" ";

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

char ch=data.charAt(i);

int b=(int)ch;

int b1=b+k;

en=en+(char)b1;

en=en+k;

dos.writeUTF(en);

ta.append("\n Your Message : "+en);

catch(Exception e)

e.printStackTrace();

if(b3==ae.getSource())

try

dis=new DataInputStream(s.getInputStream());

String data1=dis.readUTF();

System.out.println(data1);

ta.append("\n Encrypted Message: "+data1);

int len=data1.length();

char k=data1.charAt(len-1);

int k1=(int)k;

System.out.println("Key="+k1);

if((k1>=48)&&(k1<=57))

k1=k1-48;

String de="";

for(int i=0;i<(len-1);i++)

char ch=data1.charAt(i);

int b=(int)ch;

System.out.println("Key="+b);

int b1=b-k1;

de=de+(char)b1;

}
ta.append("\n Decrypted Message : "+de);

catch(Exception e)

e.printStackTrace();

if(b4==ae.getSource())

ta.setText("");

class Server_Appication

public static void main(String args[ ])

Server ob=new Server();

ob.setTitle("MH HeadQuarters");

ob.setVisible(true);

ob.setSize(800,600);

ob.setLocationRelativeTo(null);

Client_Application.java
import java.awt.*;

import java.net.*;

import java.awt.event.*;

import java.io.*;

class Client extends Frame implements ActionListener

Label l1;

TextField t1, t2,t3, t4;

TextArea ta;

Button b1, b2,b3, b4;

Socket s;

DataOutputStream dos;

DataInputStream dis;

String eyn;

Server S;

Client()

setLayout(null);
l1=new Label("Cop RIO ");

add(l1);

l1.setBounds(300,50,300,30);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,40));

l1.setForeground(Color.red);

l1=new Label("IP Address of Server:");

add(l1);

l1.setBounds(100,100,300,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForeground(Color.red);

t1=new TextField(20);

add(t1);

t1.setBounds(460,105,200,30);

l1=new Label("Port Number of Server:");

add(l1);

l1.setBounds(100,150,350,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForeground(Color.red);

t2=new TextField(20);

add(t2);

t2.setBounds(460,155,200,30);

l1=new Label("Msg to Server :");

add(l1);

l1.setBounds(100,200,250,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForeground(Color.red);

t3=new TextField(20);

add(t3);

t3.setBounds(460,205,200,30);

l1=new Label("Enter The Key: ");

add(l1);

l1.setBounds(100,250,250,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForeground(Color.red);

t4=new TextField(20);

add(t4);

t4.setBounds(460,255,200,30);

l1=new Label("Chat History : ");

add(l1);

l1.setBounds(100,300,250,40);

l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,25));

l1.setForeground(Color.red);

ta=new TextArea(10,30);

add(ta);

ta.setBounds(460,300,300,200);
b1=new Button("Connect");

add(b1);

b1.setBounds(100,500,100,30);

b1.setFont(new Font("Cambria",Font.BOLD,15));

b1.addActionListener(this);

b2=new Button("Send");

add(b2);

b2.setBounds(220,500,100,30);

b2.setFont(new Font("Cambria",Font.BOLD,15));

b2.addActionListener(this);

b3=new Button("Receive");

add(b3);

b3.setBounds(340,500,100,30);

b3.setFont(new Font("Cambria",Font.BOLD,15));

b3.addActionListener(this);

b4=new Button("Clear");

add(b4);

b4.setBounds(460,500,100,30);

b4.setFont(new Font("Cambria",Font.BOLD,15));

b4.addActionListener(this);

public void actionPerformed(ActionEvent ae)

if(b1==ae.getSource())

try

String ip=t1.getText().trim();

int port=Integer.parseInt(t2.getText().trim());

s=new Socket(ip,port);

ta.append("\nConnectionn is established");

catch(Exception e)

e.printStackTrace();

if(b2==ae.getSource())

try

dos=new DataOutputStream(s.getOutputStream());

String data=t3.getText().trim();

int k=Integer.parseInt(t4.getText());
int len=data.length();

String en=" ";

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

char ch=data.charAt(i);

int b=(int)ch;

int b1=b+k;

en=en+(char)b1;

en=en+k;

dos.writeUTF(en);

ta.append("\n Your Message : "+en);

catch(Exception e)

e.printStackTrace();

if(b3==ae.getSource())

try

dis=new DataInputStream(s.getInputStream());

String data1=dis.readUTF();

System.out.println(data1);

ta.append("\n Encrypted Message: "+data1);

int len=data1.length();

char k=data1.charAt(len-1);

int k1=(int)k;

System.out.println("Key="+k1);

if((k1>=48)&&(k1<=57))

k1=k1-48;

String de="";

for(int i=0;i<(len-1);i++)

char ch=data1.charAt(i);

int b=(int)ch;

System.out.println("Key="+b);

int b1=b-k1;

de=de+(char)b1;

ta.append("\n Decrypted Message : "+de);

}
catch(Exception e)

e.printStackTrace();

if(b4==ae.getSource())

ta.setText("");

class Client_Appication

public static void main(String args[ ])

Client ob=new Client();

ob.setTitle("Cop RIO");

ob.setVisible(true);

ob.setSize(800,600);

ob.setLocationRelativeTo(null);

Screenshots:

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy