Skip to content

Chapter 3 of 8

Cryptography and Public Key Infrastructure

Cryptography is the mathematical backbone of confidentiality, integrity, and authentication. Symmetric encryption uses a single shared key for both encryption and decryption, making it fast but raising the challenge of secure key distribution. The Advanced Encryption Standard (AES) is the dominant symmetric block cipher, standardized by NIST since 2001 with key sizes of 128, 192, or 256 bits. Asymmetric encryption uses a public/private key pair: the public key encrypts and the private key decrypts, or vice versa for signing. This solves the key distribution problem but is computationally slower. RSA is the most widely deployed asymmetric cipher, based on the difficulty of factoring large primes, with common key sizes of 2048, 3072, and 4096 bits. Elliptic Curve Cryptography (ECC) provides equivalent security with shorter keys, making it attractive for constrained environments.

Hashing is a one-way function that converts data into a fixed-length digest that cannot be reversed to recover the original input. SHA-256 is part of the SHA-2 family and produces a 256-bit output widely used for integrity verification. Older hashes such as MD5 and SHA-1 are deprecated for security purposes because collisions, situations where two different inputs produce the same hash output, have been demonstrated, undermining their integrity guarantees. Hashing is not encryption because there is no decryption key; instead, hashing verifies integrity and supports password storage. To resist rainbow tables, which are precomputed lookup tables of password hashes, modern systems add a unique random salt to each password before hashing. Dedicated password hash functions such as bcrypt, scrypt, and Argon2 are slow and memory-hard to resist GPU brute force; Argon2 is currently preferred because of its tunable memory and compute cost, side-channel resistance, and victory in the 2015 Password Hashing Competition. PBKDF2 is an older key derivation standard that applies a hash many times to slow brute force. A digital signature combines a hash with a private key to prove authenticity and integrity without revealing the secret key.

Public Key Infrastructure (PKI) is the system of certificate authorities, certificates, and policies that enables trusted public key distribution. A digital certificate is a signed document binding a public key to an identity, verified through the CA chain; the X.509 standard defines the format used in TLS, S/MIME, and code signing. A Certificate Authority (CA) is the trusted entity that issues certificates, and the root of trust is a CA whose certificate is pre-installed in operating system and browser trust stores. To obtain a certificate, an applicant submits a Certificate Signing Request (CSR). Revocation is handled through Certificate Revocation Lists (CRL) or the Online Certificate Status Protocol (OCSP), with OCSP stapling letting the server include a recent OCSP response in the TLS handshake to reduce client load. Transport Layer Security (TLS), the successor to SSL, encrypts data in transit, authenticates the server, and negotiates cipher suites during a TLS handshake. TLS 1.3 delivers a faster handshake (1-RTT, with 0-RTT for resumption) and removes legacy ciphers. Perfect forward secrecy, achieved through ephemeral key exchange like DHE or ECDHE, ensures that past sessions remain secure even if a long-term key is later compromised. HTTPS is HTTP over TLS, with HSTS and the HSTS preload list forcing browsers to use HTTPS even on first visit, and mutual TLS (mTLS) requiring both client and server to present certificates, common in zero-trust microservices. Certificate pinning, the public key pinning header (now deprecated in favor of Expect-CT and CAA records), and certificate transparency logs help detect or prevent misuse by compromised CAs.

All chapters
  1. 1Foundations of Cybersecurity
  2. 2Identity, Authentication, and Access Control
  3. 3Cryptography and Public Key Infrastructure
  4. 4Network and Infrastructure Security
  5. 5Application and Web Security
  6. 6Threats, Attacks, and Malware
  7. 7Defense Operations and Incident Response
  8. 8Governance, Risk, and Compliance

Drill it

Reading is not remembering. These come from the Cybersecurity Fundamentals deck:

Q

What are the three components of the CIA triad in cybersecurity?

Confidentiality (ensuring data is accessible only to authorized parties), Integrity (ensuring data is accurate and unaltered), and Availability (ensuring system...

Q

How does a breach of "integrity" in the CIA triad differ from a breach of "confidentiality"?

A confidentiality breach means unauthorized parties accessed the data (e.g., a data leak). An integrity breach means the data was altered or tampered with witho...

Q

Why is "availability" considered equally important as confidentiality and integrity?

Even if data remains confidential and unaltered, a system is useless if legitimate users cannot access it when needed. DDoS attacks, ransomware, and hardware fa...

Q

What is a phishing attack and what makes spear phishing more dangerous?

Phishing uses fraudulent emails or messages to trick victims into revealing sensitive information or clicking malicious links. Spear phishing targets a specific...