SlideShare a Scribd company logo
NETWORK SECURITY LAB
PROJECT PRESENTATION II
ANDROID TEXT ENCRYPTION USING
DES ALGORITHM
SUBMITTED BY: - SUBMITTED TO: -
CHANDER KANT SHARMA MS.LAVISHA SAHU
HOW DOES DESWORK?
DESis a symmetric block encryption algorithm. When 64-bit blocks of
plaintext go in, 64-bit blocks of cipher text come out.
It is also a symmetric algorithm, meaning the same key is used for
encryption and decryption.
It uses a 64-bit key: 56 bits make up the true key, and 8 bits are
used for parity.
The blocks are put through 16 rounds of transposition and
substitution functions.
The result is 64-bit blocks of ciphertext
DESADVANCEMENT CYCLE
SOURCE CODE IN JAVA
 import javax.swing.*;
import java.security.SecureRandom;
import javax.crypto.Cipher;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;
import javax.crypto.spec.SecretKeySpec;
import java.util.Random ;
class DES {
byte[] skey = new byte[1000];
String skeyString;
static byte[] raw;
String inputMessage,encryptedData,decryptedMessage;
 public DES() {
try {
generateSymmetricKey();
 inputMessage=JOptionPane.showInputDialog(null,"Enter message to encrypt");
byte[] ibyte = inputMessage.getBytes();
byte[] ebyte=encrypt(raw, ibyte);
String encryptedData = new String(ebyte);
System.out.println("Encrypted message "+encryptedData);
JOptionPane.showMessageDialog(null,"Encrypted Data "+"n"+encryptedData);
 byte[] dbyte= decrypt(raw,ebyte);
String decryptedMessage = new String(dbyte);
System.out.println("Decrypted message "+decryptedMessage);
 JOptionPane.showMessageDialog(null,"Decrypted Data "+"n"+decryptedMessage);
}
catch(Exception e) {
System.out.println(e);
}
 }
void generateSymmetricKey() {
 try {
Random r = new Random();
int num = r.nextInt(10000);
String knum = String.valueOf(num);
byte[] knumb = knum.getBytes();
skey=getRawKey(knumb);
skeyString = new String(skey);
System.out.println("DES Symmetric key = "+skeyString);
}
catch(Exception e) {
System.out.println(e);
}
}
private static byte[] getRawKey(byte[] seed) throws Exception {
KeyGenerator kgen = KeyGenerator.getInstance("DES");
SecureRandom sr = SecureRandom.getInstance("SHA1PRNG");
sr.setSeed(seed);
kgen.init(56, sr);
 SecretKey skey = kgen.generateKey();
raw = skey.getEncoded();
return raw;
}
private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec(raw, "DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.ENCRYPT_MODE, skeySpec);
byte[] encrypted = cipher.doFinal(clear);
return encrypted;
}
 private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception {
SecretKeySpec skeySpec = new SecretKeySpec(raw, "DES");
Cipher cipher = Cipher.getInstance("DES");
cipher.init(Cipher.DECRYPT_MODE, skeySpec);
byte[] decrypted = cipher.doFinal(encrypted);
return decrypted;
}
public static void main(String args[]) {
DES des = new DES();
}
}
THANK YOU!!

More Related Content

PPTX
Networking and Security in Java
PPTX
PDF
Block Ciphers Modes of Operation
PPT
Java Symmetric
PPT
padding oracle attack
PDF
researchpaperfinal1
PPTX
Byte rotation encryption algorithm
DOCX
import java-io-IOException- import java-nio-file-Files- import java-ni.docx
Networking and Security in Java
Block Ciphers Modes of Operation
Java Symmetric
padding oracle attack
researchpaperfinal1
Byte rotation encryption algorithm
import java-io-IOException- import java-nio-file-Files- import java-ni.docx

Similar to android text encryption Network security lab by rohit malav (20)

PDF
How does cryptography work? by Jeroen Ooms
PDF
Comparative Analysis of Cryptographic Algorithms and Advanced Cryptographic A...
PDF
Encrypted Negative Password using for Authentication
DOCX
encryptFile- java import java-io-IOException- import java-nio-file-Fil.docx
PPTX
Implement symmetric key algorithms.pptx
PPTX
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
PDF
Enhanced Hybrid Encryption Algorithm
PDF
Dodging WebCrypto API Landmines
PPTX
Cryptography using python
PDF
Implementation of Fast Pipelined AES Algorithm on Xilinx FPGA
PPTX
Information and data security pseudorandom number generation and stream cipher
PDF
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
PDF
Aes 128 192_256_bits_project_report
PDF
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
PPT
Encryption
PPTX
Crypto failures every developer should avoid
PPTX
Crypto failures every developer should avoid
PPTX
Secured algorithm for gsm encryption & decryption
PPTX
Blockchain Technology Explained: A Beginner's Guide to the Future of the Inte...
PPTX
Cargo Cult Security UJUG Sep2015
How does cryptography work? by Jeroen Ooms
Comparative Analysis of Cryptographic Algorithms and Advanced Cryptographic A...
Encrypted Negative Password using for Authentication
encryptFile- java import java-io-IOException- import java-nio-file-Fil.docx
Implement symmetric key algorithms.pptx
Cryptography for Java Developers: Nakov jProfessionals (Jan 2019)
Enhanced Hybrid Encryption Algorithm
Dodging WebCrypto API Landmines
Cryptography using python
Implementation of Fast Pipelined AES Algorithm on Xilinx FPGA
Information and data security pseudorandom number generation and stream cipher
DEF CON 27 - workshop ANTHONY ROSE - introduction to amsi bypasses and sandbo...
Aes 128 192_256_bits_project_report
How to Use Cryptography Properly: The Common Mistakes People Make When Using ...
Encryption
Crypto failures every developer should avoid
Crypto failures every developer should avoid
Secured algorithm for gsm encryption & decryption
Blockchain Technology Explained: A Beginner's Guide to the Future of the Inte...
Cargo Cult Security UJUG Sep2015
Ad

More from Rohit malav (20)

PPTX
Aca lab project (rohit malav)
PPTX
operating system calls input and output by (rohit malav)
PPTX
Python pandas liberary
PPTX
Presentation by purshotam verma
PPTX
Deep learning in python by purshottam verma
PPTX
Atm Security System Using Steganography Nss ptt by (rohit malav)
DOCX
Samba server Pts report pdf by Rohit malav
PPTX
System calls operating system ppt by rohit malav
PPTX
A project on spring framework by rohit malav
PPTX
samba server setup Pts ppt (rohit malav)
PPTX
Spring frame work by rohit malav(detailed)
PPTX
spring framework ppt by Rohit malav
PPTX
Samba server linux (SMB) BY ROHIT MALAV
PPTX
Payroll system ppt1 (rohit malav)
PPTX
Payroll system ppt2 (rohit malav) version point 2
PPTX
ONLINE STUDENT MANAGEMENT SYSTEM
PPTX
digital unlock power point slide
PDF
Rohit android lab projects in suresh gyan vihar
DOCX
Snake report ROHIT MALAV
PPTX
Gyan vihar app
Aca lab project (rohit malav)
operating system calls input and output by (rohit malav)
Python pandas liberary
Presentation by purshotam verma
Deep learning in python by purshottam verma
Atm Security System Using Steganography Nss ptt by (rohit malav)
Samba server Pts report pdf by Rohit malav
System calls operating system ppt by rohit malav
A project on spring framework by rohit malav
samba server setup Pts ppt (rohit malav)
Spring frame work by rohit malav(detailed)
spring framework ppt by Rohit malav
Samba server linux (SMB) BY ROHIT MALAV
Payroll system ppt1 (rohit malav)
Payroll system ppt2 (rohit malav) version point 2
ONLINE STUDENT MANAGEMENT SYSTEM
digital unlock power point slide
Rohit android lab projects in suresh gyan vihar
Snake report ROHIT MALAV
Gyan vihar app
Ad

Recently uploaded (20)

DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPT
introduction to datamining and warehousing
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPT
Mechanical Engineering MATERIALS Selection
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPT
Project quality management in manufacturing
PPTX
Safety Seminar civil to be ensured for safe working.
PPTX
CYBER-CRIMES AND SECURITY A guide to understanding
PDF
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
PPTX
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
Current and future trends in Computer Vision.pptx
PDF
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
DOCX
573137875-Attendance-Management-System-original
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
introduction to datamining and warehousing
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Model Code of Practice - Construction Work - 21102022 .pdf
Unit I ESSENTIAL OF DIGITAL MARKETING.pdf
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Mechanical Engineering MATERIALS Selection
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Project quality management in manufacturing
Safety Seminar civil to be ensured for safe working.
CYBER-CRIMES AND SECURITY A guide to understanding
July 2025 - Top 10 Read Articles in International Journal of Software Enginee...
M Tech Sem 1 Civil Engineering Environmental Sciences.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
Current and future trends in Computer Vision.pptx
Mitigating Risks through Effective Management for Enhancing Organizational Pe...
573137875-Attendance-Management-System-original

android text encryption Network security lab by rohit malav

  • 1. NETWORK SECURITY LAB PROJECT PRESENTATION II ANDROID TEXT ENCRYPTION USING DES ALGORITHM SUBMITTED BY: - SUBMITTED TO: - CHANDER KANT SHARMA MS.LAVISHA SAHU
  • 2. HOW DOES DESWORK? DESis a symmetric block encryption algorithm. When 64-bit blocks of plaintext go in, 64-bit blocks of cipher text come out. It is also a symmetric algorithm, meaning the same key is used for encryption and decryption. It uses a 64-bit key: 56 bits make up the true key, and 8 bits are used for parity. The blocks are put through 16 rounds of transposition and substitution functions. The result is 64-bit blocks of ciphertext
  • 4. SOURCE CODE IN JAVA  import javax.swing.*; import java.security.SecureRandom; import javax.crypto.Cipher; import javax.crypto.KeyGenerator; import javax.crypto.SecretKey; import javax.crypto.spec.SecretKeySpec; import java.util.Random ; class DES { byte[] skey = new byte[1000]; String skeyString; static byte[] raw; String inputMessage,encryptedData,decryptedMessage;  public DES() { try { generateSymmetricKey();
  • 5.  inputMessage=JOptionPane.showInputDialog(null,"Enter message to encrypt"); byte[] ibyte = inputMessage.getBytes(); byte[] ebyte=encrypt(raw, ibyte); String encryptedData = new String(ebyte); System.out.println("Encrypted message "+encryptedData); JOptionPane.showMessageDialog(null,"Encrypted Data "+"n"+encryptedData);  byte[] dbyte= decrypt(raw,ebyte); String decryptedMessage = new String(dbyte); System.out.println("Decrypted message "+decryptedMessage);  JOptionPane.showMessageDialog(null,"Decrypted Data "+"n"+decryptedMessage); } catch(Exception e) { System.out.println(e); }  } void generateSymmetricKey() {
  • 6.  try { Random r = new Random(); int num = r.nextInt(10000); String knum = String.valueOf(num); byte[] knumb = knum.getBytes(); skey=getRawKey(knumb); skeyString = new String(skey); System.out.println("DES Symmetric key = "+skeyString); } catch(Exception e) { System.out.println(e); } } private static byte[] getRawKey(byte[] seed) throws Exception { KeyGenerator kgen = KeyGenerator.getInstance("DES"); SecureRandom sr = SecureRandom.getInstance("SHA1PRNG"); sr.setSeed(seed); kgen.init(56, sr);
  • 7.  SecretKey skey = kgen.generateKey(); raw = skey.getEncoded(); return raw; } private static byte[] encrypt(byte[] raw, byte[] clear) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "DES"); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.ENCRYPT_MODE, skeySpec); byte[] encrypted = cipher.doFinal(clear); return encrypted; }  private static byte[] decrypt(byte[] raw, byte[] encrypted) throws Exception { SecretKeySpec skeySpec = new SecretKeySpec(raw, "DES"); Cipher cipher = Cipher.getInstance("DES"); cipher.init(Cipher.DECRYPT_MODE, skeySpec); byte[] decrypted = cipher.doFinal(encrypted); return decrypted; } public static void main(String args[]) { DES des = new DES(); } }