Assignment 11
Due on 16/05/2023
Problem(s)
Part 1
1. Create a class newRSA
with the following properties:
- Its constructor MUST take to parameters and generate a public-private key pair during the object creation.
- There must be a function
getPublicKey()
to print the public key.- There should be one function
encrypt(data, key)
that could take 2-values (numeric plaintext and public key of receiver) and return the ciphertext.- There should be one function
decrypt(ciphertext)
that could take the encrypted information and return the decrypted data by applying the private key of the current class. (private key should not be supplied to the function).- You are free to declare/inherit any additional function, as well, in the solution.
- message M must be less (smaller) than n
2. Write a function to take one numeric input N and return the largest possible number L, such that L < N in a binary form where all bits should be 1:
- For e.g., if
N = 20
, the L should be - 1111. Here, L is 15, which is the largest value as per the question.
Part 2
1. Create 2-scripts using Python socket programming concepts to encrypt/decrypt the textual data using DES having the following properties:
- It should be a D.E.S. cryptography.
- Both, Encryption and Decryption must be done on the server side.
- The user (client) should provide only 2 pieces of information:
- Plaintext/Ciphertext
- Key