Experiment with asymmetric keys. first generate a public/secret key pair using R
ID: 3603414 • Letter: E
Question
Experiment with asymmetric keys.
first generate a public/secret key pair using RSA. generate a private key (“privatekey.pem”) using this command
>> openssl genrsa -out private-key.pem 1024
and the corresponding public key
(“public-key.pem”) using this command: >> openssl rsa -in private-key.pem -pubout -out public-key.pem
2. Now you are ready to encrypt some data. Create a very small text file, say input.txt.
To encrypt this file, do this: >> openssl rsautl -encrypt -pubin -inkey public-key.pem -in input.txt -out input.enc
This will generate an encrypted output file called “input.enc”.
To decrypt the file, do >> openssl rsautl -decrypt -inkey private-key.pem -in input.enc -out answer.txt This will generate a decrypted version of “input.enc” called “answer.txt”. You can verify that answer.txt and input.txt are the same by comparing the hash outputs.
Question 1. Create an input file that is similar to the input.txt file you created before (e.g. extra spacing, punctuation, etc.). Encrypt the file using the same key as before. What can you observe from the encrypted cipher text?