Courses3 levels
Level 1 · Foundations11 courses
Level 2 · Core5 courses
Level 3 · Advanced5 courses
Labs8 topics
Library Practice exams AI Range Pricing Start free

Practice library / Security fundamentals

Workbook · Easy · 3 hours

Cryptography Fundamentals

Symmetric, asymmetric, hashing, PKI, TLS, and common crypto weaknesses.

  • cryptography
  • hashing
  • pki
  • tls
  • symmetric-encryption
On this page 8 sections
  1. ·Chapter 1 — Why Cryptography Matters
  2. ·Chapter 2 — Symmetric Encryption
  3. ·Chapter 3 — Asymmetric Encryption
  4. ·Chapter 4 — Hashing & Integrity
  5. ·Chapter 5 — PKI & Digital Certificates
  6. ·Chapter 6 — TLS/SSL Deep Dive
  7. ·Chapter 7 — Common Crypto Weaknesses
  8. ·Chapter 8 — Crypto in Practice

Cryptography is the maths behind every HTTPS connection, every password store, and every signed binary that you trust. This workbook covers the ideas that a security engineer must hold in their head: symmetric and asymmetric encryption, hash functions, PKI and X.509, TLS, and the common weaknesses that real attackers exploit. It names the modern primitives (AES-GCM, Argon2, Ed25519) and the broken ones (RC4, MD5, SHA-1) so that you can read a config file and judge it. The goal is not to invent crypto, but to recognise weak keys, padding oracles, hash collisions, and certificate games the moment you see them in a scan or a report.

Chapter 1 — Why Cryptography Matters

Cryptography is the mathematical foundation of all security. Every HTTPS connection, every password database, every signed code package depends on it. Security professionals who do not understand cryptography miss entire attack classes: weak keys, padding oracles, hash collisions, and certificate spoofing.

Chapter 2 — Symmetric Encryption

The same key encrypts and decrypts. Symmetric encryption is fast and suitable for bulk data. The modern standard is AES-256-GCM. The hard problem is key exchange.

AlgorithmKey SizeStatus
AES-256-GCM256 bitRecommended
ChaCha20-Poly1305256 bitRecommended
AES-128-CBC128 bitPadding oracle risk without MAC
3DES112 bitDeprecated (SWEET32 attack)
RC4variableBroken — never use

Chapter 3 — Asymmetric Encryption

Asymmetric encryption uses two keys: a public key (to encrypt or verify) and a private key (to decrypt or sign). It solves the key exchange problem. Common algorithms are RSA, ECDSA, and Ed25519. They are used in TLS handshakes, SSH, code signing, and PGP.

# Generate RSA key pair
openssl genrsa -out private.pem 4096
openssl rsa -in private.pem -pubout -out public.pem

# Encrypt with public key
openssl rsautl -encrypt -pubin -inkey public.pem -in plaintext.txt -out encrypted.bin

Chapter 4 — Hashing & Integrity

Hash functions are one-way functions. The same input always produces the same output, and the output is infeasible to reverse. Hashes are used for password storage, file integrity, and digital signatures.

HashOutputSecurity
SHA-256256 bitSecure
SHA-3256-512 bitSecure
bcrypt60 charsPassword storage — use this
SHA-1160 bitCollision found — avoid
MD5128 bitCollision trivial — broken

Chapter 5 — PKI & Digital Certificates

PKI (Public Key Infrastructure) is the trust system behind HTTPS. X.509 certificates bind a public key to an identity, signed by a Certificate Authority (CA). Certificate transparency logs (crt.sh) are a rich OSINT source. They list the certificates issued for a domain, including subdomains that were previously unknown.

# View certificate details
openssl s_client -connect target.com:443 | openssl x509 -noout -text

# Find subdomains via certificate transparency
curl "https://crt.sh/?q=%.target.com&output=json" | python3 -c "import sys,json; [print(r['name_value']) for r in json.load(sys.stdin)]"

Chapter 6 — TLS/SSL Deep Dive

# Test TLS configuration
testssl.sh https://target.com
sslscan target.com

# Check for weak protocols and cipher suites
nmap --script ssl-enum-ciphers -p 443 target.com

Chapter 7 — Common Crypto Weaknesses

WeaknessAttack
CBC mode without MACPadding Oracle (POODLE, BEAST)
ECB modePattern leakage — identical blocks produce identical ciphertext
Weak random number generatorPredictable nonces leading to key recovery
Short keys under 128 bitBrute force feasible
MD5/SHA1 for signaturesCollision attacks
Reused nonces in stream ciphersXOR ciphertexts together to recover plaintext

Chapter 8 — Crypto in Practice

Never roll your own cryptography. Use well-tested libraries: libsodium, cryptography.io (Python), BouncyCastle (Java). For passwords: bcrypt, scrypt, or Argon2 — never plain SHA-256. For symmetric encryption: AES-256-GCM or ChaCha20-Poly1305. For TLS: minimum TLS 1.2, prefer TLS 1.3, enforce HSTS.

Workbook complete. You have covered all chapters. Mark it complete below and choose your next item in the practice library.

Sign in to track progress and send feedback.

Related

This workbook is extra practice for the course Security fundamentals. Do the lessons first.Open the course