Information Security Lab-3 - Updated
Information Security Lab-3 - Updated
Lab Objectives
Prerequisites
1. Download OpenSSL
To perform cryptographic operations, OpenSSL must be installed on the system. Follow these
steps:
• Download the latest Win64 OpenSSL version suitable for your system.
• Choose the EXE installer (not the source code) for ease of installation.
2. Install OpenSSL
• Choose The Windows system directory when prompted for OpenSSL DLL placement.
To use OpenSSL from the command prompt, the installation path must be added to the system’s
environment variables:
3. Under System Variables, find and select Path, then click Edit.
C:\Program Files\OpenSSL-Win64\bin
4. Verify Installation
openssl version
Explanation: This command checks the installed version of OpenSSL and confirms that it is
properly configured. If the installation is successful, you should see an output similar to:
If you receive an error, check that OpenSSL is installed in the correct directory and that the
system environment variables are correctly set.
• The public key encrypts data, and the private key decrypts it.
Explanation: This command creates a text file named message.txt and writes "This is a secret
message." into it.
Explanation: This command generates a random key and IV using AES-256-CBC encryption,
based on the given password.
Example Output:
kek = 5F8C76AB87...
iv = ADFE456789...
Explanation: Encrypts message.txt using AES-256-CBC encryption and saves the encrypted data
in encrypted.txt.
Explanation: Decrypts encrypted.txt using the same password and outputs the decrypted
content into decrypted.txt.
type decrypted.txt
Explanation: Extracts the public key from the private key and saves it in public_key.pem.
openssl pkeyutl -encrypt -pubin -inkey public_key.pem -in message.txt -out encrypted_rsa.txt
Explanation: Encrypts message.txt using the public key and saves the encrypted content in
encrypted_rsa.txt.
Explanation: Decrypts encrypted_rsa.txt using the private key and stores the decrypted
message in decrypted_rsa.txt.
type decrypted_rsa.txt
Expected Output
Additional Exercises