Lab Instructions
Encryption Essentials
Follow these written lab steps in order. Run one command at a time and verify output before moving on.
Lab objective
Module 5: Encryption Essentials. Hands-on: symmetric (AES-256-CBC with OpenSSL), asymmetric (RSA with openssl genrsa), hashing (SHA-256); optional VeraCrypt USB and ethical weak-key testing in a lab.
Command
N/AExpected result: You have encrypted/decrypted a file with OpenSSL, generated an RSA key pair, and optionally used VeraCrypt and tested weak keys in a lab.
Step 1 - Symmetric: encrypt/decrypt with OpenSSL
Create a file (e.g. secret.txt). Encrypt it with AES-256-CBC: openssl enc -aes-256-cbc -in secret.txt -out secret.enc (you will be prompted for a password). Decrypt: openssl enc -aes-256-cbc -d -in secret.enc -out secret_decrypted.txt. Verify the decrypted file matches the original.
Command
openssl enc -aes-256-cbc -in secret.txt -out secret.enc # then -d to decryptExpected result: secret.enc is created; decryption recovers the original content.
Step 2 - Asymmetric: RSA key pair and encrypt demo
Generate an RSA private key: openssl genrsa -out private.pem 2048. Extract public key: openssl rsa -in private.pem -pubout -out public.pem. Optionally encrypt a short message with the public key and decrypt with the private key (openssl rsautl or pkeyutl).
Command
openssl genrsa -out private.pem 2048 # then rsa -in private.pem -pubout -out public.pemExpected result: You have private.pem and public.pem; you understand public key encrypts, private key decrypts.
Step 3 - Hashing and optional VeraCrypt / weak keys
Hash a file: sha256sum secret.txt (or openssl dgst -sha256 secret.txt). Note salting for passwords (e.g. bcrypt) as in Lessons 4–7. Optional: encrypt a USB with VeraCrypt; in a separate lab-only exercise, use a deliberately weak key to see how quickly it can be tested/cracked ethically—reinforce why strong keys matter.
Command
sha256sum secret.txt # optional: VeraCrypt volume + weak-key test in lab onlyExpected result: You can explain hashing and salting; optionally you have used VeraCrypt and seen why weak keys are risky.