INS Report
INS 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.
3.Course outcomes:
Sr. No Nam e of the Resources Speci ficati on Quanti ty
6. Program Code:
{
frame.setV isible(true);
}
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 ;
}
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());
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 ++);
}
}
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();
}
2. Data Protection