Skip to content
Lesson 3 of 14 · CompTIA Security+ (SY0-801)

Cryptography and PKI

Choose between symmetric and asymmetric encryption, hashing and signatures, and explain how certificates and PKI build trust.

17 min

Cryptography protects confidentiality (encryption), integrity (hashing) and authenticity and non-repudiation (digital signatures).

Symmetric encryption uses one shared key to encrypt and decrypt. It is fast, so it protects bulk data. AES is the standard (128-, 192- or 256-bit keys). The challenge is sharing the key safely.

Asymmetric encryption uses a key pair: a public key anyone can have and a private key you keep. What one key locks, only the other unlocks. It is slower, so it is used to exchange keys and sign. RSA and elliptic-curve (ECC) are common.

  • To send a secret to Alice, encrypt with Alice's public key. Only Alice's private key decrypts it.
  • To prove a message came from Alice, Alice signs it with her private key. Anyone verifies with her public key.

Hashing turns any data into a fixed-length fingerprint. It is one-way. A tiny change gives a completely different hash. SHA-256 is common. Hashes verify integrity. Do not use MD5 or SHA-1 for security. For passwords, use salting (random value added per password, to stop rainbow tables) and key stretching (bcrypt, PBKDF2, Argon2) to slow guessing.

TLS secures web traffic: asymmetric cryptography sets up the session and agrees a symmetric key, then fast symmetric encryption protects the data.

Choose the cryptographic tool.

Symmetric encryption

Key use
One shared key
Speed
Fast
Provides
Confidentiality
Example
AES

Best for Bulk data, disks, VPN tunnels

Asymmetric encryption

Key use
Public and private key pair
Speed
Slow
Provides
Confidentiality, key exchange, signatures
Example
RSA, ECC

Best for Key exchange, certificates

Hashing

Key use
No key (one-way)
Speed
Fast
Provides
Integrity
Example
SHA-256

Best for File integrity, password storage

Digital signature

Key use
Private key signs, public key verifies
Speed
Medium
Provides
Integrity, authenticity, non-repudiation
Example
RSA or ECDSA with a hash

Best for Software updates, signed emails

PKI (public key infrastructure) is how you know a public key really belongs to who it claims.

  • A certificate authority (CA) issues digital certificates (usually X.509) that bind an identity to a public key. The CA signs the certificate.
  • A chain of trust runs from the root CA (trusted by your device) through intermediate CAs to the server's certificate.
  • A certificate signing request (CSR) is how you ask a CA for a certificate.
  • If a certificate is compromised, it is revoked. Clients check a CRL (certificate revocation list) or use OCSP, the online protocol that asks if a certificate is still valid.
  • Key management matters: keep private keys in a hardware security module (HSM) or a TPM, rotate keys and have a recovery plan.

Other topics to know: perfect forward secrecy (a new session key per session, so old traffic stays safe if a long-term key leaks), obfuscation (steganography hides data in other data), tokenization and data masking (replace sensitive values), and that post-quantum algorithms are being adopted to resist future quantum computers.

The chain of trust a browser validates.

Decide

Choose the cryptography.

Bob wants to send Alice a message that only Alice can read. What does he encrypt it with?

Common misconception

“Hashing is a kind of encryption.”

Both scramble data.

What is actually true

Encryption is two-way: you can decrypt with the key. Hashing is one-way: you cannot get the original back. Use encryption to keep data secret and hashing to check that it has not changed.

  • Symmetric (AES): one key, fast. Asymmetric (RSA, ECC): key pair, key exchange and signatures. Hash (SHA-256): integrity.
  • Encrypt to someone with their public key. Sign with your private key.
  • Passwords need salting and key stretching (bcrypt, PBKDF2, Argon2).
  • PKI: CAs sign certificates, revocation via CRL or OCSP, keys protected in an HSM or TPM.
Check yourself

Cryptography check.

1Multiple choice

Which algorithm is symmetric?

  • AECC
  • BAES
  • CRSA
  • DSHA-256
2Multiple choice

Which provides integrity verification for a file download?

  • AA CRL
  • BA symmetric key
  • CA hash
  • DA certificate signing request
3Multiple choice

A server's certificate is found to be compromised. Which mechanism lets clients learn that it is no longer valid?

  • ACertificate revocation using CRL or OCSP
  • BKey stretching
  • CSteganography
  • DSalting
4Multiple choice

Which is the BEST way to store user passwords?

  • AUnsalted MD5
  • BSalted hashes using a key-stretching algorithm such as bcrypt
  • CEncrypt them with AES and keep the key in the same database
  • DPlain text in an access-controlled table
5Multiple choice

What does a digital signature provide that a hash alone does not?

  • AConfidentiality
  • BCompression
  • CFaster encryption
  • DAuthentication of the sender and non-repudiation
6Fill the blanks

A stores and protects cryptographic keys in dedicated tamper-resistant hardware.

Capitalisation, spacing and punctuation are ignored when grading.

Practise this lesson, not just read it

In BiliMind the questions above are marked when you answer, the flashcards come back on a schedule, and the rest of CompTIA Security+ (SY0-801) is planned around your week. Free.