29-03-2014, 10:45 AM
Crypto Lab – Secret-Key Encryption
Crypto Lab.pdf (Size: 38.21 KB / Downloads: 43)
Overview
The 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,
encryption modes, paddings, and initial vector (IV). Moreover, students will be able to use tools and write
programs to encrypt/decrypt messages.
Lab Environment
Installing and Running the VM (Virtual Machine). The majority of the lab assignments assume that
the student has an access to a Ubuntu box. If you have Ubuntu installed on your machine you can skip this
step. Otherwise, if your machine is running any other operating system, proceed to install VirtualBox, a
virtualization software which is freely available. Once you install VirtualBox, download and install a recent
version of Ubuntu OS. Note: If you wish to use your current operating system (e.g., MS Windows, MacOS,
Fedora) and avoid installing any virtualization software, you need to tailor the lab instructions accordingly.
1. Installing VirtualBox. Download and install the binary image corresponding to your host OS (cur-
rent OS) using the following link: https://www.virtualboxwiki/Downloads. During
the installation process, you may be required to disconnect your machine from the network. You will also
be prompted to install few device drivers along the way, just proceed with all installations as you may need
such drivers for future labs.
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/descrypt messages in programs.
OpenSSL provides an API called EVP, which is a high-level interface to cryptographic functions. Al-
though OpenSSL also has direct interfaces for each individual encryption algorithm, the EVP library pro-
vides a common interface for various encryption algorithms. To ask EVP to use a specific algorithm, we
simply need to pass our choice to the EVP interface. A sample code is given in http://www.openssl.
org/docs/crypto/EVP_EncryptInit.html. Please get yourself familiar with this program, and
then do the following exercise.