Skip to content
ShankarStack

Security fundamentals

Cryptography essentials for testers

You don't need to be a cryptographer, but you must recognise when cryptography is being used correctly and when it isn't. The practical skill is pattern recognition: are the right, well-known tools being used properly — or is something home-grown and broken?

The goals, not the maths

Cryptography gives us tools to achieve the security properties from the last lesson: confidentiality (encryption), integrity (hashing and signatures) and identity/authenticity (signatures and certificates). As a tester you assess whether these goals are met, not whether you can break the underlying mathematics. The golden rule you're checking against: never roll your own crypto — use vetted, standard algorithms and libraries correctly.

Encryption: symmetric vs asymmetric

Encryption scrambles data so only someone with the right key can read it.

  • Symmetric encryption uses the same key to encrypt and decrypt (e.g. AES). It's fast and used for bulk data — but both sides need the shared key, which creates a key-distribution problem.
  • Asymmetric encryption uses a key pair: a public key (shareable) and a private key (secret). Anyone can encrypt to your public key; only your private key decrypts. This solves key distribution and underpins TLS and digital signatures — but it's slower, so it's typically used to exchange a symmetric key, which then protects the bulk traffic.

Hashing is not encryption

A hash is a one-way function: it turns any input into a fixed-size fingerprint, and you cannot reverse it to recover the input. This is a crucial distinction testers must get right: encryption is reversible (with the key); hashing is not.

Hashing is used for integrity (has this file changed?) and for storing passwords. Passwords must be hashed, never encrypted, with:

  • a slow, adaptive algorithm designed for passwords (bcrypt, scrypt, Argon2) — not fast general-purpose hashes like MD5 or SHA-1 alone, and
  • a unique salt per password, so identical passwords don't produce identical hashes and precomputed-table attacks fail.

Seeing passwords stored with MD5, or without salts, is a real and common finding.

Digital signatures and certificates

A digital signature uses a private key to prove that a message came from a specific holder and wasn't altered — anyone with the public key can verify it. This provides integrity and authenticity.

A certificate binds a public key to an identity (like a domain name), signed by a trusted Certificate Authority (CA). Your browser trusts a set of CAs; when a site presents a certificate, the browser verifies the CA's signature and that the certificate matches the domain and is still valid. This is how you know you're really talking to bank.example.com.

How TLS ties it together

When you connect over HTTPS, TLS: (1) uses the server's certificate to verify identity and safely agree on a shared secret (asymmetric crypto), then (2) uses that secret for fast symmetric encryption of the actual traffic, with (3) integrity checks so tampering is detected. One handshake delivers confidentiality, integrity and identity.

Common mistakes you'll look for

  • Passwords stored with fast hashes or no salt (or, worse, encrypted or in plaintext).
  • Sensitive data sent or stored without encryption.
  • Home-grown encryption or "encoding" (like Base64) mistaken for security — encoding is not encryption.
  • Expired, self-signed or mismatched certificates; weak TLS versions or ciphers allowed.
  • Secrets (keys, tokens) hard-coded in source or configuration.

Key takeaways

  • Crypto serves confidentiality, integrity and identity — assess the goals, not the maths.
  • Symmetric = one shared key (fast, bulk data); asymmetric = public/private key pair (key exchange, signatures).
  • Hashing is one-way and not encryption; passwords must be salted and hashed with bcrypt/scrypt/Argon2.
  • Certificates bind a public key to an identity via a trusted CA; TLS combines all of this.
  • Watch for home-grown crypto, Base64-as-"encryption", weak hashes, and hard-coded secrets.

Reporting mindset: for every observation, record what you did, what you saw, the business impact, and a clear, verifiable remediation. Evidence and clear writing are what turn testing into value.

This is a free preview. Sign in to track progress and unlock the full course.

Sign in