Question: 2.8 Task 7: Programming using the Crypto Library So far, we have learned how to use the tools provided by openssl to encrypt and decrypt

2.8 Task 7: Programming using the Crypto Library So far, we have learned how to use the tools provided by openssl to encrypt and decrypt messages. In this task, we will learn how to use openssl s crypto library to encrypt/decrypt messages in programs. In this task, you are given a plaintext and a ciphertext, and your job is to find the key that is used for the encryption. You do know the following facts: --> The aes-128-cbc cipher is used for the encryption. --> The key used to encrypt this plaintext is an English word shorter than 16 characters; the word can be found from a typical English dictionary. Since the word has less than 16 characters (i.e. 128 bits), pound signs (#: hexadecimal value is 0x23 ) are appended to the end of the word to form a key of 128 bits. Your goal is to write a program to find out the encryption key. You can download an English word list from the Internet or form course Blackboard ( words.txt ). The plaintext, ciphertext, and IV are listed in the following: Plaintext (total 21 characters): This is a secret tool Ciphertext (in hex format): 53616c7465645f5fe90f4f0d0cffc0069b2ab11a7d01079a eec6df9c5bf4848fc086cbeb6b4ae6e8138f717dd7fc5a53 IV (in hex format): 010203040506070809000a0b0c0d0e0f You need to pay attention to the following issues: If you choose to store the plaintext message in a file, and feed the file to your program, you need to check whether the file length is 21. If you type the message in a text editor, you need to be aware that some editors may add a special character to the end of the file. The easiest way to store the message in a file is to use the following command (the -n flag tells echo not to add a trailing newline): $ echo -n "This is a secret tool" > file In this task, you are supposed to write your own program to invoke the crypto library. No credit will be given if you simply use the openssl commands to do this task. Sample code can be found from the following URL: OpenSSL: EVP Encrypt Int When you compile your code using gcc , do not forget to include the -lcrypto flag, because your code needs the crypto library. See the following example: $ gcc -o myenc myenc.c -lcrypto

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!