Question: 1. Encryption/Decryption 1. Generate a public/private RSA key pair. The keys will be stored in a file named RSAPriKey.pem, and protected by a password. The

1. Encryption/Decryption 1. Generate a public/private RSA key pair. The keys will be stored in a file named RSAPriKey.pem, and protected by a password. The size of the private key is 2048 bits: root@kali:~#openssl genrsa -des3 -out RSAPriKey.pem 2048 root@kali:~#more RSAPriKey.pem To view the internal values generated: root@kali:~#openssl pkey -in RSAPriKey.pem -text 2. Extract the public key and save it in a file named RSAPubKey.pem : root@kali:~#openssl rsa -in RSAPriKey.pem -out RSAPubKey.pem -pubout root@kali:~#more RSAPubKey.pem 3. Encrypt a file using the RSA algorithm. [Note: RSA as described in the textbooks is not secure (it is malleable).Thats why particular implementations of RSA add some randomized padding (using the PKCS#1 standard). In the following we use RSA without padding (again thats insecure), and so we need to use a 256 bytes-long plaintext]. Create a file containing the character x 256 times: root@kali:~#for i in {1..256}; do echo -n x | cat >> confidential.txt; done root@kali:~#openssl rsautl -encrypt -inkey RSAPubKey.pem -pubin -in confidential.txt -out confidential.enc -raw root@kali:~#more confidential.enc 4. Decrypt the file: root@kali:~#openssl rsautl -decrypt -inkey RSAPriKey.pem -in confidential.enc -out recovered.txt -raw 5. Change one character in the plaintext. Encrypt the new file using the public key. root@kali:~#cp confidential.txt confidentialMod.txt root@kali:~#nano -L confidentialMod.txt root@kali:~#openssl rsautl -encrypt -inkey RSAPubKey.pem -pubin -in confidentialMod.txt -out confidentialMod.enc -raw root@kali:~#more confidentialMod.enc

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!