Switch to full style
Concepts ,articles and discussions
Post a reply

ENCRYPTION TECHNIQUE

Sat Sep 29, 2012 4:34 am

CAN ANYONE LET ME KNOW , WHICH ENCRYPTION AND DECRYPTION TECHNIQUE IS USED IN THE CODE ATTACHED....


Attachments
SingleFileEncrypt.java
This is an encryption technique which i am using for media files. But I wanna know which technique is this .Please let me know if any one knows..
(4.11 KiB) Downloaded 769 times
FileEncryptDecrypt.java
This is an encryption technique which i am using for media files. But I wanna know which technique is this .Please let me know if any one knows..
(2.09 KiB) Downloaded 760 times

Re: ENCRYPTION TECHNIQUE

Mon Jan 21, 2013 11:12 pm

Trying to figure out ! these file read .exe file ? and take encryption key ..mmm
java code
import java.awt.*;
import java.awt.event.*;
import javax.swing.text.*;
import java.util.zip.*;
import javax.swing.*;
import java.io.*;
import javax.swing.border.*;
public class SingleFileEncrypt extends JFrame implements ActionListener{
JButton b1,b2,b3,b4,close;
File f;
Font font;
JOptionPane op=new JOptionPane();
String fname="";
FileInputStream fis;
JFileChooser fc;
DeflaterOutputStream dos;
int key=0;
FileOutputStream fos;
String ext="";
InflaterInputStream iis;
String output="";
SingleFileEncrypt(){

ImageIcon b1i=new ImageIcon("E.gif");
ImageIcon b2i=new ImageIcon("D.gif");
b2=new JButton("Decrypt",b2i);
ImageIcon img2=new ImageIcon("java.gif");
b3=new JButton("",img2);
ImageIcon img3=new ImageIcon("brain.gif");
ImageIcon img4=new ImageIcon("NLogo.gif");
b1=new JButton("Encrypt",img3);
b4=new JButton("",img4);
close=new JButton("Close Window");
fc=new JFileChooser();
b1.setBackground(Color.green);
b2.setBackground(Color.green);
Container c=getContentPane();
op.showMessageDialog(this,"Lets Protect Your Data...........");
op.showMessageDialog(this,"By Mr.Nanddeswar(MCA)");
font=new Font("times new roman",Font.BOLD,33);
c.setLayout(null);
b1.setBounds(10,10,300,200);
b2.setBounds(600,10,300,200);
b4.setBounds(10,620,300,150);
b3.setBounds(860,620,120,150);
close.setBounds(650,620,100,50);
b1.setFont(font);
b2.setFont(font);
b3.setFont(font);
b4.setFont(font);
close.setFont(font);
c.add(b1);c.add(b2);c.add(b3);c.add(b4);c.add(close);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);
close.addActionListener(this);
}
public void actionPerformed(ActionEvent ae){
Object o=ae.getSource();
if(o==b1){
int n=fc.showOpenDialog(this);
if(n==JFileChooser.APPROVE_OPTION){
f=fc.getSelectedFile();
try{
try{
key=Integer.parseInt(op.showInputDialog("Enter Key:"));
}catch(NumberFormatException ne){
key=2;
op.showMessageDialog(this,"The default KEY is used");
}
fis=new FileInputStream(f);
output=op.showInputDialog(this,"Enter the Output Encrypted file Name");
if(output.equals(""))
{
output="Default";
op.showMessageDialog(this,"The Default File Name is used");
}
ext=op.showInputDialog("Enter extention");
if(!ext.equals(""))
fos=new FileOutputStream(output+"."+ext);
else
{
fos=new FileOutputStream(output+".exe");
op.showMessageDialog(this,"File created with Default extension");
}

dos=new DeflaterOutputStream(fos);
int ed;
while((ed=fis.read())!=-1) dos.write(ed+key);
fis.close();dos.close();fis.close();
op.showMessageDialog(this,"Encryption Successfully Completed");
op.showMessageDialog(this,"Encrypted File will be placed at where the project file is existed ");
ext="";
output="";
}catch(Exception e){e.printStackTrace();}
}
}
if(o==b4){

op.showMessageDialog(this,"Nandu Logo");
}
if(o==b2){
int n=fc.showOpenDialog(this);
if(n==JFileChooser.APPROVE_OPTION){
f=fc.getSelectedFile();
try{
fis=new FileInputStream(f);
try{
key=Integer.parseInt(op.showInputDialog("Enter Key:"));
}catch(NumberFormatException ne){
key=2;
op.showMessageDialog(this,"The default KEY is used");
}
iis=new InflaterInputStream(fis);
output=op.showInputDialog(this,"Enter output Decrypted file name");
if(output.equals(""))
{
output="Default";
op.showMessageDialog(this,"The Default File Name is used");
}
ext=op.showInputDialog("Enter extention");
if(!ext.equals(""))
fos=new FileOutputStream(output+"."+ext);
else
{
fos=new FileOutputStream(output+".txt");
op.showMessageDialog(this,"File created with Default extension");
}
int dd;
while((dd=iis.read())!=-1) fos.write(dd-key);
fis.close();iis.close();fos.close();
op.showMessageDialog(this,"Decryption Successfully Completed");
op.showMessageDialog(this,"Decrypted File will be placed at where the project file is existed ");
ext="";
output="";
}catch(Exception e){e.printStackTrace();}
}
}
if(o==b3){

op.showMessageDialog(this,"Java Logo");
}

if(o==close){

this.dispose();
}
}

}
//end of file


java code
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
class FileEncryptDecrypt extends JFrame implements ActionListener{

JButton b1,b2,b3,b4;
Font font;
JOptionPane op=new JOptionPane();

FileEncryptDecrypt(){

ImageIcon b1i=new ImageIcon("E.gif");
ImageIcon b2i=new ImageIcon("D.gif");
b2=new JButton("Secure All Files",b2i);
ImageIcon img2=new ImageIcon("java.gif");
b3=new JButton("",img2);
ImageIcon img3=new ImageIcon("brain.gif");
ImageIcon img4=new ImageIcon("NLogo.gif");
b1=new JButton("Secure One File",img3);
b4=new JButton("",img4);
b1.setBackground(Color.green);
b2.setBackground(Color.green);

Container c=getContentPane();
op.showMessageDialog(this,"Lets Protect Your Data...........");
op.showMessageDialog(this,"By Mr.Nanddeswar(MCA)");
font=new Font("times new roman",Font.BOLD,22);
c.setLayout(null);
b1.setBounds(10,10,400,200);
b2.setBounds(600,10,350,200);
b4.setBounds(10,620,300,150);
b3.setBounds(860,620,120,150);
b1.setFont(font);
b2.setFont(font);
b3.setFont(font);
b4.setFont(font);
c.add(b1);c.add(b2);c.add(b3);c.add(b4);
b1.addActionListener(this);
b2.addActionListener(this);
b3.addActionListener(this);
b4.addActionListener(this);

}
public void actionPerformed(ActionEvent ae){
Object o=ae.getSource();
if(o==b1){

SingleFileEncrypt ne=new SingleFileEncrypt();
ne.setTitle("Secure One File");
ne.setSize(1000,800);
ne.setVisible(true);
//ne.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

if(o==b2){

MultipleFilesEncrypt nv=new MultipleFilesEncrypt();
nv.setTitle("Secure All Files");
nv.setSize(1000,800);
nv.setVisible(true);
//nv.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}

if(o==b3){
op.showMessageDialog(this,"Java Logo");
}

if(o==b4){
op.showMessageDialog(this,"Nandu Logo");
}
}

public static void main(String ar[])throws Exception{

FileEncryptDecrypt ned=new FileEncryptDecrypt();
ned.setTitle("Nandu Experiment");
ned.setSize(1000,800);
ned.setVisible(true);
ned.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
}//end of file


Post a reply
  Related Posts  to : ENCRYPTION TECHNIQUE
 Encryption and Decryption encryption Affine cipher code     -  
 Encryption Algorithm{Data Encryption Standard}     -  
 Playfair Cipher technique     -  
 Polyalphabetic cipher technique     -  
 RowTransposition Cipher technique     -  
 encryption/ decryption without key using C++     -  
 Encryption decoding     -  
 video encryption     -  
 j2me encryption     -  
 encryption and decryption in c++     -