00->1
Learning pathStep 8 of 62Foundations ← All writeups

Cryptography Basics, Explained

If you are reading this, you have probably seen the words encryption, hash, certificate and key in almost every security course, and you want to know what each one really means and how they fit together.

By the end you will be able to explain the difference between encoding, encryption and hashing; say when to use symmetric and when to use asymmetric cryptography; describe what a digital signature proves; explain what a certificate and a certificate authority do; and name the mistakes that break real systems even when the mathematics is sound. You will also run a few safe experiments on your own computer.

You do not need any mathematics. This post explains what the tools do and when to use them, not how the algorithms work inside. That is on purpose, and it is also the first lesson: you should use well-tested cryptography, never invent your own.


1. What cryptography is, and what it gives you

NIST's glossary gives one short definition of cryptography:

"The art and science of using mathematics to secure information and create a high degree of trust in the electronic realm." (NISTIR 7316, via the NIST glossary)

In practice, cryptography is the toolbox behind several of the goals you met in the CIA Triad. It is not the only safeguard for any of them, but it is the main technical one for these:

What you want The cryptographic tool Example
Secrecy (confidentiality) Encryption Nobody on the café Wi-Fi can read your HTTPS traffic
Detecting changes (integrity) Hashes, message authentication codes, signatures A downloaded file has not been altered
Knowing who sent it (authentication) Signatures, certificates, message authentication codes The website really belongs to the name in the address bar
Proof the signer cannot deny (non-repudiation) Digital signatures A signed software update came from the vendor's key

NIST's description of a digital signature names three of these together: it "provides origin authentication, data integrity and signatory non-repudiation" (NIST glossary, from SP 800-89).

The vocabulary

Term Meaning
Plaintext The readable data you start with
Ciphertext The scrambled output of encryption
Algorithm (cipher) The published recipe that does the scrambling, such as AES
Key The secret (or key pair) that the recipe needs. The same algorithm with a different key gives a different result
Encrypt / decrypt Turn plaintext into ciphertext, and back

The rule that explains everything: the key is the secret, not the recipe

In 1883 the cryptographer Auguste Kerckhoffs wrote that a cipher system "should not require secrecy, and it should not be a problem if it falls into enemy hands" (as translated on Wikipedia). Claude Shannon later put it as "the enemy knows the system". The practical meaning is simple: good algorithms are public, studied by thousands of experts for years, and their security rests only on the key.

This is why the standard advice for builders is blunt. The OWASP Cryptographic Storage Cheat Sheet's entry on designing your own algorithms is: "Don't do this." (OWASP). A homemade cipher that "nobody has seen" has not been tested by anyone.

Encoding, encryption and hashing are three different things

Beginners mix these up more than anything else, and the mistake appears in real code.

Encoding Encryption Hashing
Purpose Change the format so data can be stored or sent Keep data secret Make a fixed-size fingerprint
Needs a key? No Yes No (plain hashes)
Reversible? Yes, by anyone Yes, with the key No, by design
Example Base64 AES SHA-256
Protects secrecy? No Yes No (it is not meant to)

RFC 4648, the standard for Base64, says in its security considerations that encoding "does not provide any computational confidentiality" (RFC 4648, section 12). Base64 only turns bytes into printable letters. If you see a password stored as Base64, it is not protected at all.


2. Symmetric encryption: one shared key

NIST defines a symmetric key algorithm as one that "uses the same secret key for an operation and its complement (e.g., encryption and decryption)" (NIST SP 800-57 Part 1 Rev. 5, via the glossary). It is also called a secret-key algorithm.

The picture: a padlock with one key. Anyone who has a copy of the key can lock and unlock. Both sides need the same secret.

AES, the standard you will meet everywhere

The standard symmetric cipher is AES, the Advanced Encryption Standard. NIST's FIPS 197 says AES has three members, AES-128, AES-192 and AES-256. Each one transforms data in blocks of 128 bits, and the number in the name is the key length in bits (FIPS 197). OWASP recommends AES with a key of at least 128 bits, and prefers 256 bits where possible.

Symmetric ciphers are fast, so they do the bulk of the work: encrypting disks, files, database fields and the data stream inside a HTTPS connection.

A cipher alone is not enough: modes

AES only handles one 128-bit block. To encrypt a longer message, you choose a mode of operation, and the choice matters.

Mode What to know
ECB Encrypts every block separately, so identical blocks of plaintext give identical blocks of ciphertext. Wikipedia explains that it "fails to hide data patterns when it encrypts identical plaintext blocks into identical ciphertext blocks", and illustrates it with a recognisable picture of the Linux penguin that survives encryption (block cipher modes). OWASP: "ECB should not be used outside of very specific circumstances"
GCM and CCM Authenticated encryption. OWASP says these "should be used as a first preference". They hide the data and also detect tampering. GCM is specified in NIST SP 800-38D
ChaCha20-Poly1305 Another authenticated design, defined for internet protocols in RFC 8439. TLS 1.3 uses it as well as AES-GCM (see Handshakes)

Two ideas from this table are worth keeping:

  1. Encryption without a tamper check is risky. An attacker who cannot read ciphertext may still be able to change it, and the receiver may not notice. Authenticated modes catch this. The CIA Triad post makes the same point.
  2. A nonce must never repeat. Authenticated modes take a value called a nonce (a number used once). RFC 8439 says the nonce "MUST not be repeated for the same key". The OpenSSL documentation goes further and warns that the common authenticated modes "suffer from catastrophic failure of confidentiality and/or integrity upon reuse of key/iv/nonce" (openssl-enc manual). This is a classic way for correct algorithms to be used incorrectly, and it is another reason to use a well-built library that handles nonces for you.

The weakness of symmetric encryption: sharing the key

If two strangers want to talk privately, how do they agree on a shared key without someone listening? Sending the key over the same channel defeats the purpose. This is the key distribution problem, and it is why asymmetric cryptography exists.


3. Asymmetric encryption: a key pair

NIST describes asymmetric (public key) cryptography as "cryptography that uses two separate keys to exchange data", one to encrypt or sign and one to decrypt or verify, and notes it is "also known as public key cryptography" (NIST SP 800-77 Rev. 1, via the glossary).

You make a key pair: a public key you can give to everyone, and a private key you never share. Anything the public key locks, only the private key opens, and the two are mathematically linked.

Two pictures help:

  • A mailbox. Anyone can drop a letter through the slot (the public key), but only the owner with the key can open the box (the private key).
  • A wax seal. Only you can make your seal, but anyone can look at it and check it is yours. This is how signatures work (section 5).

What asymmetric cryptography is used for

Job Idea Examples
Key establishment Two parties who have never met agree on a shared secret over an open channel Diffie-Hellman and elliptic-curve versions such as X25519 (RFC 7748)
Digital signatures Prove who signed and that the data has not changed RSA, ECDSA and EdDSA, specified in FIPS 186-5

RSA can also encrypt small values directly, but modern protocols prefer key agreement: Handshakes shows how TLS 1.3 uses a temporary key exchange, removed static RSA key exchange, and gets forward secrecy as a result.

Why not use asymmetric encryption for everything?

It is much slower than symmetric encryption, and its keys are bigger. NIST's key-management guidance (SP 800-57 Part 1 Rev. 5, Table 2) compares the key sizes that give about the same strength:

Security strength (bits) Symmetric RSA modulus size Elliptic curve key size
112 3TDEA (a legacy cipher) 2048 224 to 255
128 AES-128 3072 256 to 383
192 AES-192 7680 384 to 511
256 AES-256 15360 512 and up

This is the reason for the hybrid design that nearly all systems use: asymmetric cryptography to agree on a key and to prove identity, then symmetric cryptography, which is fast, for the actual data. HTTPS does exactly this.

Two details from that NIST document are useful. Algorithms estimated below 112 bits of strength "are no longer approved for applying cryptographic protection" on US federal information. And NIST adds that these strength estimates "will be significantly affected when quantum computing becomes a practical consideration", which is section 8.


4. Hashing: a fingerprint, not encryption

NIST defines a hash function as "a function that maps a bit string of arbitrary (although bounded) length to a fixed-length bit string" (NIST SP 800-57 Part 1 Rev. 5).

Think of a fingerprint. Any file, from one letter to a whole movie, produces an output of the same length. Change a single character and the output changes completely. There is no key, and you cannot run it backwards.

NIST lists the properties a good cryptographic hash needs. The two to remember:

  • Preimage-resistant: "computationally infeasible to find an input that maps to any pre-specified output".
  • Collision-resistant: "computationally infeasible to find any two distinct inputs that map to the same output".

Which hash functions are safe?

NIST's hash function page lists the approved ones: the SHA-2 family (SHA-256, SHA-384, SHA-512 and others, in FIPS 180-4) and the four fixed-length SHA-3 functions (FIPS 202) (NIST hash functions).

Two old ones you must not use where security matters:

  • MD5. RFC 6151 says the published attacks "show that it is not prudent to use MD5 when collision resistance is required" (RFC 6151).
  • SHA-1. NIST deprecated it in 2011 and disallowed its use for digital signatures at the end of 2013 (NIST). In February 2017 researchers at CWI Amsterdam and Google published the first real SHA-1 collision, two different PDF files with the same SHA-1 value (SHAttered). The team says it took roughly nine quintillion SHA-1 computations (about 6,500 CPU-years and 110 GPU-years), which is huge but thousands of times faster than brute force. It showed the weakness was real.

What hashing is used for

Use How
Integrity checks Compare the hash of a download with the one the publisher lists, as in the lab in CIA Triad
Signatures A signature is made over the hash of a document, not the whole document (section 5)
Password storage Store a hash of the password, not the password itself (see below)
Message authentication Combine a hash with a secret key (HMAC, below)

Hashing passwords is a special case

A plain, fast hash such as SHA-256 is a poor choice for passwords, because attackers can guess billions of passwords a second against a stolen database. Password storage uses slow, salted hashes made for the job. A salt is random data added per password, so identical passwords do not give identical hashes and precomputed tables stop working. The OWASP Password Storage Cheat Sheet recommends Argon2id as the first choice, with at least 19 MiB of memory, two iterations and one degree of parallelism. Its alternatives are scrypt, bcrypt for older systems, and PBKDF2 where FIPS-140 compliance is required (OWASP). Brute Force vs Password Spraying explains why this matters for defence.

HMAC: a hash with a shared secret

A plain hash can be recomputed by anyone, so an attacker who changes a message can also change the hash. HMAC fixes this by mixing a secret key into the hash. FIPS 198-1 says "HMAC can be used with any iterative Approved cryptographic hash function, in combination with a shared secret key" (FIPS 198-1). Only someone with the key can produce a valid tag, so HMAC proves both that the message is unchanged and that it came from a key holder. Because both sides hold the same key, though, it cannot prove which of them made it. For that you need a signature.


5. Digital signatures: proof of who and what

A digital signature uses an asymmetric key pair in the opposite direction from encryption.

  1. In the usual scheme, the signer hashes the data, then uses their private key to produce the signature.
  2. Anyone with the signer's public key can verify it: the check passes only if the data is unchanged and the signature was made with the matching private key.

That gives you the three properties in NIST's definition: origin authentication, data integrity and signatory non-repudiation.

FIPS 186-5 specifies three signature algorithm families: RSA, ECDSA and EdDSA. It also states that it "no longer approves the DSA for digital signature generation", though DSA may still be used to verify older signatures (FIPS 186-5, section 4).

Where you meet signatures

Place What is signed
Software updates and code The installer or update, so you can tell it came from the vendor
TLS The server signs part of the handshake to show it holds the private key for its certificate (see Handshakes)
Email DKIM signs outgoing mail (see Spoofing)
Git Signed commits (see Git and GitHub)
Certificates A certificate authority signs each certificate (next section)

Encryption versus signing, side by side

Encrypting for someone Signing
Whose key makes it? Recipient's public key Your own private key
Whose key reads or checks it? Recipient's private key Anyone, using your public key
What it gives Secrecy Authenticity, integrity, non-repudiation

A signature does not hide the data. A signed message can still be readable by anyone.


6. Certificates and PKI: trusting a public key

Asymmetric cryptography has an obvious problem. If I give you a public key and say "this is the bank's", how do you know? An attacker in the middle could swap in their own key. The maths cannot answer a question about the real world.

A digital certificate answers it. A certificate is a document that binds an identity (such as a domain name) to a public key, and is signed by a certificate authority (CA) that you already trust. The format used on the internet is X.509, profiled in RFC 5280: "This memo profiles the X.509 v3 certificate and X.509 v2 certificate revocation list (CRL) for use in the Internet."

NIST describes a public key infrastructure (PKI) as "a framework that is established to issue, maintain, and revoke public key certificates" (NIST SP 800-57 Part 1 Rev. 5, via the glossary).

The chain of trust

You do not trust each website. Your operating system and browser ship with a list of root CAs they trust. A root rarely signs websites directly; it signs intermediate CAs, which sign the site's own (leaf) certificate:

Root CA (in your trust store)
  └── Intermediate CA (signed by the root)
        └── Leaf certificate for the website (signed by the intermediate)

When you open an HTTPS site, the server sends its certificate and the intermediates. The browser checks that:

  1. The chain leads up to a root it trusts, with valid signatures at each step.
  2. The certificate is valid for the name you asked for.
  3. It is within its dates.
  4. It has not been revoked.

The server also has to prove it holds the matching private key, which is the signed step in the TLS handshake. A certificate is public, so anyone could copy it; only the real owner has the private key.

If any check fails, the browser shows a warning. Treat the warning as the system working, not as an obstacle. Clicking through it switches off the check that protects you from someone sitting between you and the site (see Man-in-the-Middle Attacks).

What can go wrong with trust

Problem Meaning
A CA is hacked or misissues The attacker gets a valid certificate for a name they do not own. DigiNotar (2011) is the standard example (see Man-in-the-Middle Attacks)
A private key leaks Anyone with it can impersonate the site until the certificate is revoked or expires
A certificate expires The browser rejects it, and the site is effectively down. This is common and avoidable
Self-signed certificate The certificate vouches for itself, so no one else has agreed to trust it. Fine for a lab, wrong for a public site

Revocation, transparency and shorter lifetimes

  • Revocation. If a key is stolen, the certificate must be cancelled before it expires. The traditional tools are CRLs (lists of revoked certificates) and OCSP (asking a server whether one certificate is still good). The picture is changing: Let's Encrypt shut down its OCSP service on 6 August 2025, citing the privacy risk (the CA can see which sites a visitor is checking), and now publishes revocation information through CRLs only (Let's Encrypt).
  • Certificate Transparency. Public logs record the TLS certificates that CAs issue, so anyone can audit a CA's activity and a wrongly issued certificate is easier to spot (RFC 9162).
  • Shorter lifetimes. The industry's Baseline Requirements cut the maximum validity of publicly trusted TLS certificates in steps: 200 days from 15 March 2026, 100 days from 15 March 2027, and 47 days from 15 March 2029 (CA/Browser Forum Baseline Requirements, introduced by ballot SC-081v3, which describes the old limit as 398 days). Shorter lifetimes limit the damage from a stolen key, but they mean certificates must be renewed automatically, since a human will not remember every few weeks.

7. Putting it together: what happens in HTTPS

Almost every idea in this post is at work when you open a secure website:

Step Tool used
The server proves its identity Certificate signed by a CA, plus a signature made with its private key
The two sides agree on a fresh secret Asymmetric key agreement (elliptic-curve Diffie-Hellman)
The page data is encrypted and protected from tampering Symmetric authenticated encryption, such as AES-GCM or ChaCha20-Poly1305
Keys and checks are derived Hash functions

Handshakes goes through each message. The same pieces appear elsewhere: Wi-Fi security, SSH logins, passkeys (see Git and GitHub for the key-pair idea in practice), disk encryption and encrypted backups. When data is protected at rest, in transit or in use, as in Data Security and Privacy, these are the tools underneath.


8. Key management: the hard part

The mathematics is rarely what fails. Keys are. If an attacker steals the key, the best algorithm in the world does nothing. NIST publishes a whole series, SP 800-57, on key management for this reason.

Practical rules, mostly from the OWASP Cryptographic Storage Cheat Sheet:

Rule Why
Generate keys with a cryptographically secure random generator Predictable keys can be guessed. "Keys should be randomly generated using a cryptographically secure function"
Never hard-code keys in source code Code is copied, shared and pushed to repositories. OWASP also says keep keys out of version control. See Git and GitHub
Store keys separately from the data they protect OWASP: "Where possible, encryption keys should be stored in a separate location from encrypted data." An attacker who reaches only one side cannot read the data
Rotate keys OWASP says to rotate when a key is suspected compromised, and after a set period, called the cryptoperiod
Have a formal, tested key-management process OWASP asks for formal processes, tested, covering things like distributing and rotating keys

Some of the safest keys never leave dedicated hardware. NIST's glossary describes a TPM (Trusted Platform Module) as "a tamper-resistant integrated circuit built into some computer motherboards that can perform cryptographic operations (including key generation) and protect small amounts of sensitive information, such as passwords and cryptographic keys" (NIST SP 800-147). NIST's glossary has an entry for the hardware security module (HSM), a related kind of dedicated device (NIST glossary).

Also remember the other side of key management: a lost key means lost data. If the only key to an encrypted backup is destroyed, nobody can recover it, including you.


9. Quantum computers and post-quantum cryptography

A large enough quantum computer could break the public-key algorithms in this post: RSA, Diffie-Hellman and elliptic-curve cryptography. (The best-known quantum method for this is Shor's algorithm.) Symmetric ciphers and hashes are affected much less. NIST's post-quantum FAQ says "AES 128 will remain secure for decades to come" and that AES-192 and AES-256 "will still be safe for a very long time" (NIST PQC FAQ).

Such a computer does not exist in practical form today, so why worry now? Because of "harvest now, decrypt later": an attacker can record encrypted traffic today and decrypt it in future once the technology exists. Data that must stay secret for many years is exposed the moment it is captured. CISA's post-quantum initiative page uses this term when it discusses reducing that risk (CISA).

What has been standardised

Standard What it covers
FIPS 203: ML-KEM Key establishment (a "key-encapsulation mechanism"), relying on a lattice problem believed to be hard even for quantum computers
FIPS 204: ML-DSA Digital signatures
FIPS 205: SLH-DSA Hash-based digital signatures, based on SPHINCS+

NIST published FIPS 203, 204 and 205 on 13 August 2024, and selected a further algorithm, HQC, for standardization on 11 March 2025 (NIST).

NIST's final report IR 8547, "Transition to Post-Quantum Cryptography Standards" (October 2026), sets the timetable: "NIST will deprecate quantum-vulnerable public-key cryptography after 2030 and disallow its use under NIST standards and guidelines after 2035" (NIST IR 8547).

What this means for you as a beginner: nothing you must do by hand. The move to these new algorithms happens inside operating systems, browsers, libraries and servers. What you can do is keep software updated, prefer standard libraries, and know the term "crypto-agility": systems should be built so an algorithm can be replaced without rebuilding everything.


10. Try it: five safe experiments

Everything here runs on your own computer, on files you create. Use the OpenSSL command line. These commands were tested with OpenSSL 4.1.0 on macOS, and the hashing, encryption, signing and certificate steps also worked with macOS's built-in LibreSSL 3.3.6. Run openssl version to see which one you have. If you use Windows, run these in WSL (see Linux Fundamentals).

Use throwaway passwords and keys. Never reuse a real password in an experiment.

Experiment 1: a fingerprint of any size

printf 'Hello, world\n' > hello.txt
openssl dgst -sha256 hello.txt
# SHA2-256(hello.txt)= 37980c33951de6b0e450c3701b219bfeee930544705f637cd1158b63827bb390

(On LibreSSL the label shows as SHA256(hello.txt)=; the hash is the same.) Now change one letter, from world to World, and hash again. You get 8663bab6d124806b9727f89bb4ab9db4cbcc3862f6bbf22024dfa7212aa4ab7d, which shares nothing with the first. Compare the lengths of other algorithms on the same file:

openssl dgst -md5 hello.txt     # 32 hex characters: a7966bf58e23583c9a5a4059383ff850
openssl dgst -sha1 hello.txt    # 40 hex characters: 7b4758d4baa20873585b9597c7cb9ace2d690ab8

Remember these two are shown to see their size, not to use them for security.

Experiment 2: encoding is not encryption

base64 < hello.txt
# SGVsbG8sIHdvcmxkCg==
base64 < hello.txt | base64 -d
# Hello, world

Anyone can decode it, with no key. Compare with the next experiment.

Experiment 3: symmetric encryption with a password

openssl enc -aes-256-cbc -pbkdf2 -salt -in hello.txt -out hello.enc -pass pass:lab-password-1
head -c 8 hello.enc; echo
# Salted__
openssl enc -d -aes-256-cbc -pbkdf2 -in hello.enc -pass pass:lab-password-1
# Hello, world

Run the encrypt command twice and compare the two .enc files: they differ, because a fresh random salt is used each time. Then try decrypting with a wrong password. Usually you get a bad decrypt error, but not always. The OpenSSL manual explains that padding gives only a "rudimentary integrity or password check", and that random data passes it with a better than 1 in 256 chance. In other words, this command does not reliably tell you that the file was tampered with or that the password was wrong, because it does not use an authenticated mode. The same manual states that openssl enc does not support GCM or CCM and will not support them in future. This is a good demonstration of why authenticated encryption in a proper library matters. The experiment is for learning, not for protecting real data.

Experiment 4: sign and verify

openssl genrsa -out private.pem 2048
openssl rsa -in private.pem -pubout -out public.pem
openssl dgst -sha256 -sign private.pem -out hello.sig hello.txt
openssl dgst -sha256 -verify public.pem -signature hello.sig hello.txt
# Verified OK

The signature file is 256 bytes for a 2048-bit RSA key. Now change the data and verify again:

printf 'Hello, World\n' > hello-changed.txt
openssl dgst -sha256 -verify public.pem -signature hello.sig hello-changed.txt
# Verification failure  (the exact wording and extra error lines vary by version)

One changed letter and the signature no longer fits. Note that you shared only public.pem; the private.pem file is the secret.

Experiment 5: read a certificate, and see why self-signing is not trusted

openssl req -x509 -newkey rsa:2048 -nodes -keyout lab.key -out lab.crt -days 30 -subj "/CN=lab.example"
openssl x509 -in lab.crt -noout -subject -issuer -dates
# subject=CN=lab.example
# issuer=CN=lab.example
# notBefore=...
# notAfter=...
openssl verify lab.crt
# error 18 at 0 depth lookup: self-signed certificate

The subject and the issuer are the same, because the certificate signed itself, so no trusted CA vouches for it. That is exactly what a browser warning about a self-signed certificate means. (LibreSSL prints a slightly different layout, such as subject= /CN=lab.example.) Then open any HTTPS site in your browser, find the certificate details from the padlock or site-information menu (the wording differs between browsers), and look for the same fields: the subject name, the issuer, the validity dates and the chain above it.

Delete the lab files when you finish: rm -f hello.txt hello-changed.txt hello.enc hello.sig private.pem public.pem lab.key lab.crt.


11. Common mistakes

Mistake The facts
"Base64 is encryption" It is an encoding. Anyone can reverse it without a key
"Hashing is encryption" A hash cannot be reversed and has no key. Encryption is meant to be reversed by the key holder
"A secret algorithm is more secure" Good algorithms are public. The security must rest on the key (Kerckhoffs)
"I'll write my own encryption" OWASP's advice: "Don't do this." Use standard algorithms from a reputable library
"Encrypted means safe from tampering" Only authenticated modes (GCM, CCM, ChaCha20-Poly1305) detect changes
"Use ECB, it's simple" ECB leaks patterns. Use an authenticated mode
"Reuse the nonce, it's only a number" Repeating a nonce with the same key can break confidentiality and integrity
"MD5 or SHA-1 is fine for security" Both have known collision attacks. Use SHA-256 or stronger
"SHA-256 is a good password hash" It is too fast. Use Argon2id or another slow, salted password hash
"The padlock means the site is safe" It means the connection is encrypted to that site. A phishing site can have a valid certificate too. See Phishing
"Click through the certificate warning, it is probably fine" The warning is the defence against a man-in-the-middle
"A key in the code is fine for now" Code gets copied and pushed. Keep keys out of source and version control
"Quantum computers break all encryption" They mainly threaten today's public-key algorithms. AES-256 and SHA-2 are far less affected

Closing

Cryptography gives you four things: secrecy, detection of change, proof of who, and proof a signer cannot deny. Symmetric encryption does the fast bulk work; asymmetric cryptography agrees keys and signs; hashes make fingerprints; certificates tie public keys to real names; and key management decides whether any of it holds in practice.

Keep these points:

  • Encoding is not encryption, and hashing is not encryption. Check which one you are looking at.
  • Public algorithms, secret keys. Never invent your own cryptography.
  • Prefer authenticated encryption (AES-GCM, ChaCha20-Poly1305), and never repeat a nonce.
  • Hybrid is the norm. Asymmetric to agree and prove, symmetric for the data.
  • Signatures prove who and what; HMAC proves a shared-key holder made it.
  • Certificates and CAs answer "whose public key is this?" and a failed check is a reason to stop.
  • Keys are the weak point. Generate them securely, keep them out of code, rotate them, and back them up.
  • Quantum affects public-key cryptography first, and the standards to replace it exist.

If you can explain, in your own words, what happens to a message from the moment you type a password into HTTPS until it is safely stored on a server, naming the tool at each step, you understand the foundation.

Related: Handshakes shows these tools working together in TLS, Man-in-the-Middle Attacks shows what happens when certificate trust fails, and Data Security and Privacy applies encryption to data at rest, in transit and in use.