Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

4:53 PM 89%, KAUSTFUJM programming projects pdf Projects list 1) Secure communic

ID: 3572031 • Letter: 4

Question

4:53 PM 89%, KAUSTFUJM programming projects pdf Projects list 1) Secure communication through cryptography Sending the data fromthe transmitter to the receiver through an open and non-secure wireless channel could allow unauthorized individuals to intercept and read the data. You are assigned the task of designing an encryption and decryption functions using either C++ or MATLAB to make sure that even if the data was intercepted by any unauthorized person he will not be able to understand its meaning. The encryption function is described as follows: Get the text to be sent (P) and replace each letter of it with its substitution according to the table below: A, B CDE F GHIJK LMNO PQRST UVWXYZ ZYX WVUTSR QPON MLKJIH G FEDCBA replaced with 2 eg Ais Consider that each letter of the alphabet is assigned a number starting with A 01 and ending at Z 26. Get the numerical representation of each letter generated from the previous step and save it in array. eg Cis represented with Add K to each element of the created array in the previous step to generate a new array where each element is shifted by knumbers. Combine the previous array in one cell variable that is called C. eg The array containing 0301 25 will be 0B0125 Cis the encrypted message that will be sent through the non-secure medium. You are supposed to present two functions: Encryption function o Receive the plain text Pand the key K. o Return the encrypted text C. Decryption function o Receive the encrypted text Cand the key o Return the plain text P.

Explanation / Answer

import javax.crypto.Cipher;
2
import javax.crypto.KeyGenerator;
3
import javax.crypto.SecretKey;
4
import javax.xml.bind.DatatypeConverter;
5

6
/**
7
* this instance program shows however AES secret writing and cryptography is wiped out Java.
8
* Please note that secret key and encrypted text is unclear binary and therefore
9
* within the following program we tend to show it in positional representation system format of the underlying bytes.
10
* @author Jayson
11
*/
12
public category AESEncryption an understandable text for secret writing
16
* 2. Get a secret key (printed in positional representation system form). In actual use this should
17
* by encrypted and unbroken safe. identical secret is needed for cryptography.
18
* 3.
19
*/
20
public static void main(String[] args) throws Exception seven
55
Cipher aesCipher = Cipher.getInstance("AES");
56
aesCipher.init(Cipher.ENCRYPT_MODE, secKey);
57
byte[] byteCipherText = aesCipher.doFinal(plainText.getBytes());
58
come byteCipherText;
59
}
60

61
/**
62
* Decrypts encrypted computer memory unit array exploitation the key used for secret writing.
63
* @param byteCipherText
64
* @param secKey
65
* @return
66
* @throws Exception
67
*/
68
public static String decryptText(byte[] byteCipherText, SecretKey secKey) throws Exception seven
70
Cipher aesCipher = Cipher.getInstance("AES");
71
aesCipher.init(Cipher.DECRYPT_MODE, secKey);
72
byte[] bytePlainText = aesCipher.doFinal(byteCipherText);
73
come new String(bytePlainText);
74
}
75

76
/**
77
* Convert a binary computer memory unit array into clear hex type
78
* @param hash
79
* @return
80
*/
81
non-public static String bytesToHex(byte[] hash) {
82
come DatatypeConverter.printHexBinary(hash);
83
}
84
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote