Answered! Ther are two types of Encryption, briefly explain one of those types and provide a partial code example…

Ther are two types of Encryption, briefly explain one of those types and provide a partial code example

Expert Answer

There are two type of Encryption present today:

Don't use plagiarized sources. Get Your Custom Essay on
Answered! Ther are two types of Encryption, briefly explain one of those types and provide a partial code example…
GET AN ESSAY WRITTEN FOR YOU FROM AS LOW AS $13/PAGE
Order Essay

1. symmetric or shared secret Encryption:
In this form we encode some data on sender side using a secret key. We then pass the message to the other side. The recepient must know the same key to decrypt the data. This form basically is based on that both parties know the secret key.

2. Assymetric or public key encryption:
In this form both parties have one private and one public key each. The sender encodes the data using the public key of recepient. The recepient can decrypt the data using their private key. In this form both parties need not know the private keys of each other, while the public keys of all parties are known to everyone. This is what we use in SSH.

JAVA code example of symmetric key:

Sender side:

byte[] key = //… secret sequence of bytes, Receiver should know it
byte[] dataToSend = …

Cipher c = Cipher.getInstance(“AES”);
SecretKeySpec k =
new SecretKeySpec(key, “AES”);
c.init(Cipher.ENCRYPT_MODE, k);
byte[] encryptedData = c.doFinal(dataToSend);

// now send encryptedData to Recepient…

Receiver Side:

byte[] key = //… we know the secret!
byte[] encryptedData = //BYte data which has been received from Sender

Cipher c = Cipher.getInstance(“AES”);
SecretKeySpec k =
new SecretKeySpec(key, “AES”);
c.init(Cipher.DECRYPT_MODE, k);
byte[] data = c.doFinal(encryptedData);

// The data is now available in decrypted format

Still stressed from student homework?
Get quality assistance from academic writers!