Week 4: Introduction to Cryptography

Path: Defensive Operations | Module: 4 of 6

The Art of Secret Writing

Cryptography ensures Confidentiality and Integrity. It is the math that allows the internet to function securely.

1. Hashing (Integrity)

One-way math. You can turn "Hello" into a hash, but you can't turn the hash back into "Hello". Used for password storage and file verification.

  • Algorithms: MD5 (Broken, do not use), SHA-256 (Standard).

2. Symmetric Encryption (Confidentiality)

The same key locks and unlocks the data. Fast, but you have to safely share the key.

  • Algorithms: AES (Advanced Encryption Standard).

3. Asymmetric Encryption (Public Key)

Two keys: A Public Key (to lock) and a Private Key (to unlock). Solves the "key sharing" problem.

  • Uses: SSH, HTTPS (TLS), PGP.

🔬 Lab Exercise: GPG Encryption

Objective: Send a secret message.

  1. Create a text file named secret.txt.
  2. Install GPG.
  3. Encrypt the file with a password (Symmetric): gpg -c secret.txt.
  4. This creates secret.txt.gpg.
  5. Delete the original.
  6. Decrypt it: gpg -d secret.txt.gpg.