Assignment 12
Due on 21/05/2023
Problem(s)
Part 1
1. Implement 2 functions, i.e., encRSA(data, pubKey)
and decRSA(encData, pvtKey)
to encrypt and decrypt the byte-strings (data and encData), respectively. Follow the instructions:
- Convert provided data to byte string (if it is in any different format)
- Use base64 conversion for the textual representation of bytes
- Proceed with the encryption/decryption as per the text encryption/decryption done in Lab-12.
- MUST add essential padding to the
base64
string while encryption and remove the same while process of decryption.
2. Update the previous newRSA
class as a new class dynamicRSA
for auto-detecting the input datatype and encrypt/decrypt the same.
- You may inherit
newRSA
to declaredynamicRSA
- The class must generate the RSA key-pair and keep the keys saved in some variable (as in
newRSA
)
Part 2:
1. Bob, unfortunately, encrypted a text message M
using his RSA private key. while communicating with John. He had a nightmare that his message, somehow, got leaked. Can you decrypt the original message M
? (CHALLENGE QUESTION)
- Bob’s public key (known to everyone) is:
[11, 1159]
- The encrypted message (binary format) is saved as
secret.enc
that could be downloaded after providing your roll number below.