Total members 11895 |It is currently Sun Dec 22, 2024 9:43 am Login / Join Codemiles

Java

C/C++

PHP

C#

HTML

CSS

ASP

Javascript

JQuery

AJAX

XSD

Python

Matlab

R Scripts

Weka





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




Attachments:
File comment: 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..
SingleFileEncrypt.java [4.11 KiB]
Downloaded 776 times
File comment: 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..
FileEncryptDecrypt.java [2.09 KiB]
Downloaded 769 times
Author:
Newbie
User avatar Posts: 4
Have thanks: 0 time

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


_________________
M. S. Rakha, Ph.D.
Queen's University
Canada


Author:
Mastermind
User avatar Posts: 2715
Have thanks: 74 time
Post new topic Reply to topic  [ 2 posts ] 

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









Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
All copyrights reserved to codemiles.com 2007-2011
mileX v1.0 designed by codemiles team
Codemiles.com is a participant in the Amazon Services LLC Associates Program, an affiliate advertising program designed to provide a means for sites to earn advertising fees by advertising and linking to Amazon.com