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.