Ajp Micro-Project
Ajp Micro-Project
Ajp Micro-Project
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
import java.net.*;
import java.awt.event.*;
import java.io.*;
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);
add(l1);
l1.setBounds(300,50,400,45);
l1.setFont(new Font("Copperplate",Font.BOLD+Font.ITALIC,40));
l1.setForeground(Color.red);
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);
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);
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);
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);
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();
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);
catch(Exception e)
e.printStackTrace();
if(b3==ae.getSource())
try
dis=new DataInputStream(s.getInputStream());
String data1=dis.readUTF();
System.out.println(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
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.*;
Label l1;
TextArea ta;
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);
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);
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);
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);
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);
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);
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();
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);
catch(Exception e)
e.printStackTrace();
if(b3==ae.getSource())
try
dis=new DataInputStream(s.getInputStream());
String data1=dis.readUTF();
System.out.println(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;
}
catch(Exception e)
e.printStackTrace();
if(b4==ae.getSource())
ta.setText("");
class Client_Appication
ob.setTitle("Cop RIO");
ob.setVisible(true);
ob.setSize(800,600);
ob.setLocationRelativeTo(null);
Screenshots: