
” 辅导Secret-Key 留学生程序、 写作Crypto algorithms、c++程序SEED Labs 1Crypto Lab Secret-Key EncryptionThe development of this document is/was funded by three grants from the US National Science Foundation:Awards No. 0231122 and 0618680 from TUES/CCLI and Award No. 1017771 from Trustworthy Computing.Permission is granted to copy, distribute and/or modify this document under the terms of the GNU FreeDocumentation License, Version 1.2 or any later version published by the Free Software Foundation. A copyof the license can Be found at https://www.gnu.org/licenses/fdl.html.1 OverviewThe learning objective of this lab is for students to get familiar with the concepts in the secret-key encryption.After finishing the lab, students should be able to gain a first-hand experience on encryption algorithms .Moreover, students will be able to use tools and write programs to encrypt/decrypt messages.2 Lab EnvironmentInstalling OpenSSL. In this lab, we will use openssl commands and libraries. We have already installedopenssl binaries in our VM. It should be noted that if you want to use openssl libraries inyour programs, you need to install several other things for the programming environment, including theheader files, libraries, manuals, etc. We have already downloaded the necessary files under the directory/home/seed/openssl-1.0.1. To configure and install openssl libraries, go to the openssl-1.0.1folder and run the following commands.You should read the INSTALL file first:% sudo ./config% sudo Make% sudo make test% sudo make install 辅导data留学生作业、 写作algorithms作业、Installing a hex editor. In this lab, we need to be able to view and modify files of binary format. We haveinstalled in our VM a hex editor called GHex. It allows the user to load data from any file, view and edit itin either hex or ascii. Note: many people told us that another hex editor, called Bless, is better; this toolmay not be installed in the VM version that you are using, but you can install it yourself using the followingcommand:% sudo apt-get install bless3 Lab Tasks3.1 Task 1: Encryption Using different ciphersIn this task, we will play with various encryption algorithms and modes. You can use the followingopenssl enc command to encrypt/decrypt a file. To see the manuals, you can type man openssland man enc.SEED Labs 2% openssl enc ciphertype -e -in plain.txt -out cipher.bin \\r-K 00112233445566778889aabbccddeeff \\r-iv 0102030405060708Please replace the ciphertype with a specific cipher type, such as -aes-128-cbc, -bf-cbc, etc.In this task, you should try at least 3 different ciphers . You can find the meaning of the command-lineoptions and all the supported cipher types by typing man enc. We include some common options forthe openssl enc command in the following:-in file input file-out file output file-e encrypt-d decrypt-K/-iv key/iv in hex is the next argument-[pP] print the iv/key (then exit if -P)3.2 Task 2: Programming using the Crypto LibrarySo far, we have learned how to use the tools provided by openssl to encrypt and decrypt messages. Inthis task, we will learn how to use openssls crypto library to encrypt/descrypt messages in programs.OpenSSL provides an API called EVP, which is a high-level interface to cryptographic functions. AlthoughOpenSSL also has direct interfaces for each individual encryption algorithm, the EVP library providesa common interface for various encryption algorithms. To ask EVP to use a specific algorithm, we simplyneed to pass our Choice to the EVP interface. A sample code is given in httpss://www.openssl.org/docs/man1.0.2/crypto/EVP_EncryptInit.html. Please get yourself familiar with thisprogram, and then do the following exercise.You are given a plaintext and a ciphertext, and you know that aes-128-cbc is used to generate theciphertext from the plaintext, and you also know that the numbers in the IV are all zeros (not the ASCIIcharacter 0). Another clue that you have learned is that the key used to encrypt this plaintext is an Englishword shorter than 16 characters; the word that can be found from a typical English dictionary. Since theword has less than 16 characters (i.e. 128 bits), space characters (hexadecimal value 0x20) are appended tothe end of the word to form a key of 128 bits. Your goal is to write a program to find out this key. You candownload a English word list from the Internet. We have also linked one on the web page of this lab. Theplaintext and ciphertext is in the following:Plaintext (total 21 characters): This is a top secret.Ciphertext (in hex format): 8d20e5056a8d24d0462ce74e4904c1b513e10d1df4a2ef2ad4540fae1ca0aaf9Note 1: If you choose to store the plaintex message in a file, and feed the file to your program, you needto check whether the file length is 21. Some editors may add a special character to the end of the file. If thathappens, you can use a hex editor tool to remove the special character.Note 2: In this task, You are supposed to write your own program to invoke the crypto library. No creditwill be given if you simply use the openssl commands to do this task.SEED Labs 3Note 3: To compile your code, you may need to include the header files in openssl, and link toopenssl libraries. To do that, you need to tell your compiler where those files are. In your Makefile,you may want to Specify the following:INC=/usr/local/ssl/include/LIB=/usr/local/ssl/lib/all:gcc -I$(INC) -L$(LIB) -o enc yourcode.c -lcrypto -ldl4 SubmissionYou need to submit a detailed lab report to describe what you have done and what you have observed; youalso need to provide explanation to the observations that are interesting or surprising. In your report, youneed to answer all The questions listed in this lab.如有需要,请加QQ:99515681 或邮箱:99515681@qq.com
“
添加老师微信回复‘’官网 辅导‘’获取专业老师帮助,或点击联系老师1对1在线指导。






