Lab 12 (17/05/2023)
Problems for lab session:
Practicals
Part 1
1. Implement RSA for ‘textual’ data encryption and decryption, keeping following instructions in account:
- Convert char. string to binary string before the encryption
- Unencrypted numbers (representing textual string block) should be represented in N-2 bits
- Encrypted numbers (representing ciphertext’s block) should be represented in N bits
- The ciphertext should be a binary string
- You must demonstrate the both encryption and decryption
* N represents the length of n in RSA key-pair.
Part 2
1. Diffie-Hellman key exchange algorithm
- Consider a prime number q
- Consider primitive root (generator) alpha of q such that
alpha < q- Take
xPrvand findxMap = alpha ^ xPrv mod q. Similarly findyMapusingyPrv.- Find
K1such thatK1 = yMap ^ xPrv mod qfor user X. Similarly findK2- Check for the equality of
K1andK2.