Junior Cybersecurity Analyst

Cryptography Essentials

The crypto every defender must understand: symmetric vs. asymmetric encryption, hashing, digital signatures, and how TLS + PKI combine them to secure the web.

30 min

1. Executive Summary & Objective

Cryptography underpins Confidentiality and Integrity. You don’t need to invent algorithms, but you must know which tool solves which problem — and how TLS and PKI combine them to secure every HTTPS connection.

Objective: Distinguish symmetric vs. asymmetric encryption and hashing, explain digital signatures, and trace how TLS + PKI use all three to secure the web.

2. Core Concept & Theory (The “Why”)

Tool Keys Solves Example
Symmetric encryption one shared key fast bulk confidentiality AES-256
Asymmetric encryption public + private pair key distribution, identity RSA, ECC
Hashing none (one-way) integrity, password storage SHA-256
Digital signature sign w/ private, verify w/ public integrity + authenticity + non-repudiation RSA/ECDSA sign

3. Architecture & Topology (Visualizing): the TLS handshake

Asymmetric crypto + the CA-signed certificate authenticate the server and agree a key; the symmetric session key then encrypts the real traffic.

4. Digital Signatures & PKI

A digital signature is made by hashing data and encrypting the hash with the signer’s private key. Anyone can verify it with the signer’s public key — proving the data is unaltered (integrity) and came from the holder of the private key (authenticity + non-repudiation).

PKI (Public Key Infrastructure) scales trust: a Certificate Authority signs certificates binding identities to public keys. Your browser trusts a set of root CAs, so it can trust any certificate they signed — which is how it knows https://bank.com really is the bank.

Why can't an attacker who intercepts your HTTPS traffic simply present their own certificate for bank.com?

Their certificate wouldn’t be signed by a trusted CA for bank.com (they can’t get a CA to sign a domain they don’t control). The browser’s PKI validation fails, so the MitM is detected — this is exactly what certificate validation prevents.

5. Common Pitfalls

  • Storing passwords with a plain hash — use a slow, salted hash (bcrypt/argon2), not raw SHA-256.
  • Rolling your own crypto — use vetted libraries/protocols (TLS, libsodium).
  • Ignoring certificate validation in scripts (curl -k) — it disables the very protection PKI provides.

5.5 Hands-on: hashing and salting in real Python

Theory sticks once you run it. Use Python’s hashlib to see three truths for yourself: a hash is fixed-length, it’s deterministic (same input → same digest), and a salt makes the same password hash differently — which is exactly why salting defeats precomputed “rainbow table” attacks.

Hashing & Salting — Python 3
YOUR CODE (edit here, then press Run)
Ctrl/⌘ + Enter
OUTPUT

This is why task 1 of password storage is “never store a plain hash” — a salted, slow hash (bcrypt/argon2) forces an attacker to crack every password individually instead of looking them all up in a precomputed table.

6. Key Takeaways

  • Symmetric = fast, shared key; asymmetric = key distribution + identity; hashing = one-way integrity.
  • TLS uses asymmetric to agree a key, then symmetric for bulk data.
  • Digital signatures = integrity + authenticity + non-repudiation.
  • PKI/CAs bind identity to public keys so trust scales across the internet.

7. Capture the Flag 🚩

Decoding is a daily skill for a security analyst. The string below is Base64-encoded — decode it to reveal the real flag, then submit it:

R1RBe2NyeXB0b19pc19rZXl9

(Tip: Python’s base64.b64decode(...) — you can run it in the lab above. The flag is in GTA{...} form.)

The flag box is at the bottom of the lesson.

🧪 Want to practise this on your own computer? See how to set up your lab →

🤖

Need clarification? Ask GT

Hi, I'm GT — your AI tutor for Cryptography Essentials. What would you like to know?
📝

Knowledge Check

1 of 4

What is the core difference between symmetric and asymmetric encryption?

⚑ Capture The Flag

Report a problem

About: /lessons/cryptography-essentials