0% found this document useful (0 votes)
11 views12 pages

INS Report

This micro-project report focuses on encryption and decryption techniques essential for securing data against unauthorized access and cyber threats. It aims to enhance understanding of cryptographic concepts, including symmetric and asymmetric encryption, while providing practical programming skills in implementing these techniques. The project also emphasizes the importance of key management and raises awareness about the significance of encryption in preventing cyber threats.

Uploaded by

adityapandji1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views12 pages

INS Report

This micro-project report focuses on encryption and decryption techniques essential for securing data against unauthorized access and cyber threats. It aims to enhance understanding of cryptographic concepts, including symmetric and asymmetric encryption, while providing practical programming skills in implementing these techniques. The project also emphasizes the importance of key management and raises awareness about the significance of encryption in preventing cyber threats.

Uploaded by

adityapandji1
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

Micro-Project Report

Information Security
(314319)
Cipher Text: En cry ption an d Decry ption

1.Ration ale: -
En cr yption an d decr yption are essen tial for securin g data from
un authorized access an d cyber threats. This micro project focuses on
tran sformin g plain text in to cipher text usin g en cr yption algorithms an d
decr yptin g it back for authorized users. It explores symmetric an d
asymmetric en cr yption , hashin g, an d key man agemen t. The project
provides han ds-on experien ce in cr yptographic security mechan isms used
in secure commun ication an d data protection . Implemen tin g an
en cr yption -decr yption system en han ces un derstan din g of cybersecurity
con cepts. It also develops practical sk ills in cr yptography an d
programmin g. This k n ow ledge is crucial for addressin g modern security
challen ges an d forms a foun dation for advan ced cybersecurity studies.

2.Aims of the Microproject: -


The aim of this project is to un derstan d the fun damen tal con cepts of
en cr yption an d decr yption in cr yptography an d implemen t a basic system
for securin g data. It focuses on explorin g symmetric an d asymmetric
en cr yption techn iques w hile emphasizin g the impor tan ce of key
man agemen t in en surin g data security. The project en han ces practical
k n ow ledge of cybersecurity by demon stratin g real-w orld application s of
en cr yption in secure commun ication an d data protection . Addition ally, it
helps in developin g programmin g sk ills related to cr yptographic
techn iques an d raises aw aren ess about the sign ifican ce of en cr yption in
preven tin g cyber threats.
.

3.Course outcomes:

1. C02: Apply Multifactor user Authen tication an d access con trol


mechan isms on file, folder, device an d application s.
2. CO3: Apply basic en cr yption an d decr yption techn iques for given
text.
3. CO5: Implemen t security techn iques to preven t in tern et threats.

4.Actual Methodology Follow ed:

1. Fin alizin g the selected topic.


2. Gatherin g in formation about the Cipher techn iques.
3. U n derstan din g the con cept of Tasm softw are.
4. Mak in g the code for various Cipher en cr yption an d decr yption .
5. Developin g the code.
6. Check in g for errors.
7. Preparin g Repor t an d Proposal.

5. Actual Resources used:

Sr. No Nam e of the Resources Speci ficati on Quanti ty

1. Laptop W i ndow s 10 2

2. Jav a Softw are Jdk 1.8.321 1

3. Notes M anual s 1

6. Program Code:

impor t javax.sw in g.;

import java.aw t.;

impor t java.aw t.even t.Action Even t;

impor t java.aw t.even t.Action Listen er ;

public class CipherGU I

{

private JFrame frame;


private JTextField passw ordField, keyField;

private JTextArea outputArea;

private JComboBox cipherBox;

private JRadioButton en cr yptButton , decr yptButton ;

public CipherGU I() {


frame = n ew JFrame("Cipher En cr yption & Decr yption");
frame.setSize(500, 400);
frame.setDefaultCloseOperation (JFrame.EX IT_ ON_ CLOSE);
frame.setLayout(n ew Flow Layout());

frame.add(n ew JLabel("Choose Cipher Techn ique:"));


Strin g[] ciphers = {"Caesar ", "Vern am", "Playfair ", "V igen ere"};
cipherBox = n ew JComboBox<>(ciphers);
frame.add(cipherBox);

en cr yptButton = n ew JRadioButton ("En cr ypt", true);


decr yptButton = n ew JRadioButton ("Decr ypt");
Button Group action Group = n ew Button Group();
action Group.add(en cr yptButton );
action Group.add(decr yptButton );
frame.add(en cr yptButton );
frame.add(decr yptButton );

frame.add(n ew JLabel("En ter Passw ord:"));


passw ordField = n ew JTextField(20);
frame.add(passw ordField);

frame.add(n ew JLabel("En ter Key (On ly for Vern am, Playfair,


V igen ere):"));
keyField = n ew JTextField(20);
frame.add(keyField);

JButton processButton = n ew JButton ("Process");


frame.add(processButton );

outputArea = n ew JTextArea(5, 40);


outputArea.setEditable(false);
frame.add(n ew JScrollPan e(outputArea));

processButton .addAction Listen er (n ew Action Listen er() {


@Override
public void action Per formed(Action Even t e) {
processCipher();
}
});

frame.setV isible(true);
}

private void processCipher() {


Strin g text = passw ordField.getText();
Strin g key = keyField.getText();
Strin g selectedCipher = (Strin g) cipherBox.getSelectedItem();
boolean decr ypt = decr yptButton .isSelected();

if (text.isEmpty()) {
JOption Pan e.show MessageDialog(frame, "Please en ter a passw ord!",
"Error ", JOption Pan e.ERROR_ MESSAGE);
return ;
}
if ((selectedCipher.equals("Vern am") || selectedCipher.equals("Playfair ") ||
selectedCipher.equals("V igen ere")) && key.isEmpty ()) {
JOption Pan e.show MessageDialog(frame, "Please en ter a key!", "Error ",
JOption Pan e.ERROR_ MESSAGE);
return ;
}

Strin g result = "";


sw itch (selectedCipher) {
case "Caesar ":
result = caesarCipher(text, 3, decr ypt);
break ;
case "Vern am":
result = vern amCipher (text, key, decr ypt);
break ;
case "Playfair ":
result = playfairCipher (text, key, decr ypt);
break ;
case "V igen ere":
result = vigen ereCipher(text, key, decr ypt);
break ;
}

outputArea.setText("Cipher: " + selectedCipher + "\n Action : " + (decr ypt ?


"Decr ypt" : "En cr ypt") + "\n Result: " + result);
}

private Strin g caesarCipher(Strin g text, in t shift, boolean decr ypt) {


if (decr ypt) shift = -shift;
Strin gBuilder result = n ew Strin gBuilder();
for (char c : text.toCharArray ()) {
if (Character.isLetter (c)) {
char base = Character.isU pperCase(c) ? 'A' : 'a';
result.appen d((char) ((c - base + shift + 26) % 26 + base));
} else {
result.appen d(c);
}
}
return result.toStrin g();
}

private Strin g vern amCipher (Strin g text, Strin g key, boolean decr ypt) {
Strin gBuilder repeatedKey = n ew Strin gBuilder();
w hile (repeatedKey.len gth () < text.len gth()) {
repeatedKey.appen d(key);
}
key = repeatedKey.substrin g(0, text.len gth());

Strin gBuilder result = n ew Strin gBuilder();


for (in t i = 0; i < text.len gth(); i++) {
result.appen d((char) (text.charAt(i) ^ key.charAt(i)));
}
return result.toStrin g();
}

private Strin g playfairCipher (Strin g text, Strin g key, boolean decr ypt) {
text = text.replaceAll(" ", "").toLow erCase();
key = key.replaceAll(" ", "").toLow erCase();
Strin g alphabet = "abcdefghijk lmn opqrstuvw xyz";
Strin gBuilder keyMatrix = n ew Strin gBuilder();
for (char c : (key + alphabet).toCharArray ()) {
if (keyMatrix.in dexOf(Strin g.valueOf(c)) == -1) {
keyMatrix.appen d(c);
}
}
char[][] matrix = n ew char[5][5];
for (in t i = 0, k = 0; i < 5; i++) {
for (in t j = 0; j < 5; j++) {
matrix[i][j] = keyMatrix.charAt(k ++);
}
}

Strin gBuilder result = n ew Strin gBuilder();


for (in t i = 0; i < text.len gth(); i += 2) {
char a = text.charAt(i);
char b = (i + 1 < text.len gth()) ? text.charAt(i + 1) : 'x';
in t[] posA = fin dPosition (matrix, a);
in t[] posB = fin dPosition (matrix, b);
if (posA[0] == posB[0]) {
posA[1] = (posA[1] + (decr ypt ? -1 : 1) + 5) % 5;
posB[1] = (posB[1] + (decr ypt ? -1 : 1) + 5) % 5;
} else if (posA[1] == posB[1]) {
posA[0] = (posA[0] + (decr ypt ? -1 : 1) + 5) % 5;
posB[0] = (posB[0] + (decr ypt ? -1 : 1) + 5) % 5;
} else {
in t temp = posA[1];
posA[1] = posB[1];
posB[1] = temp;
}
result.appen d(matrix[posA[0]][posA[1]]).appen d(matrix[posB[0]][posB[1]]);
}
return result.toStrin g();
}

private in t[] fin dPosition (char[][] matrix, char letter) {


for (in t i = 0; i < 5; i++) {
for (in t j = 0; j < 5; j++) {
if (matrix[i][j] == letter) return n ew in t[]{i, j};
}
}
return n ull;
}

private Strin g vigen ereCipher(Strin g text, Strin g key, boolean decr ypt) {
Strin gBuilder result = n ew Strin gBuilder();
for (in t i = 0; i < text.len gth(); i++) {
char curren tChar = text.charAt(i);
in t shift = Character.toLow erCase(key.charAt(i % key.len gth())) - 'a';
if (decr ypt) shift = -shift;
if (Character.isLetter (curren tChar )) {
char base = Character.isU pperCase(curren tChar ) ? 'A' : 'a';
result.appen d((char) ((curren tChar - base + shift + 26) % 26 + base));
} else {
result.appen d(curren tChar );
}
}
return result.toStrin g();
}

public static void main (Strin g[] args) {


n ew CipherGU I();
}
}

7.Output of the program:

1.1. Caesar Cipher (En cr yption ):


1.2. Caesar Cipher (Decr yption ):
2.1. Playfair Cipher (En cr yption ):

2.2. Playfair Cipher (Decr yption ):


3.1. V igen ere Cipher (En cr yption ):

3.2. V igen ere Cipher (Decr yption ):


4.1. Vern am Cipher (En cr yption ):

4.2. Vern am Cipher (Decr yption ):


8. Sk illed Developed in this micro-project:

1. Cr yptographic K n ow ledge – U n derstan din g en cr yption , decr yption ,


an d key man agemen t techn iques.

2. Programmin g Sk ills – Implemen tin g en cr yption algorithms usin g


Py thon , Java, or C.

3. Problem-Solvin g Abilities – Applyin g logical thin k in g to secure


data usin g cr yptographic methods.

4. Cybersecurity Aw aren ess – U n derstan din g how en cr yption


protects data from cyber threats.

5. An aly tical Sk ills – Evaluatin g differen t en cr yption techn iques an d


their effectiven ess.

9.Application of this micro-project: -

1. Secure Commun ication

2. Data Protection

3. On lin e Ban k in g an d Tran saction s

4. Cybersecurity an d Netw ork Security

5. Passw ord Protection

6. E-Govern an ce an d Digital Iden tity

7. Block chain an d Cr yptocurren cies

You might also like