- Learn
- Computer Science & IT
- Cybersecurity
- Cybersecurity Fundamentals
- Cryptography and PKI
Cryptography and PKI
BeginnerLesson 4 of 8 in Cybersecurity Fundamentals Course
What you will learn
- Use the core vocabulary of cryptography, explain how one shared secret key encrypts and decrypts data, and choose where encryption protects data at rest, in transit and in use.
- Describe what cryptography protects and how keys workName the security goals that cryptography supports, use its basic terms correctly, and explain why the key, not the algorithm, must stay secret.
- Encrypt data with symmetric ciphersExplain how symmetric algorithms such as AES and ChaCha20 use one shared key, how modes, nonces and authentication tags work, and why sharing the key is the main difficulty.
- Choose encryption for data at rest, in transit and in useMatch encryption to the state of the data and to the level where it is applied, from a whole disk to a single database field, and tell encryption apart from masking, tokenization and steganography.
- Describe what cryptography protects and how keys work
- Explain how public and private key pairs work, how two parties agree on a shared key over an open network, and why real systems combine asymmetric and symmetric encryption.
- Explain public and private key pairsDescribe what each key in a pair is used for, compare RSA with elliptic-curve cryptography, and decide which key to use for encrypting and which for signing.
- Agree on keys and combine asymmetric and symmetric encryptionExplain how Diffie–Hellman key exchange creates a shared secret over an open network, why ephemeral keys give forward secrecy, and how hybrid encryption protects real messages and files.
- Explain public and private key pairs
- Use hash functions to detect changes, store passwords safely with salting and key stretching, and explain how digital signatures show who signed data and that it has not changed.
- Check integrity with hash functionsDescribe the properties of cryptographic hash functions, tell current algorithms from broken ones, and use a published hash to check a file.
- Store passwords with salting and key stretchingExplain how systems store passwords as salted, deliberately slow hashes, and why this defeats lookup tables and slows down guessing after a breach.
- Sign data and verify digital signaturesExplain how a digital signature is created and verified, what it proves and what it does not, and how it differs from a message authentication code.
- Check integrity with hash functions
- Read a digital certificate, follow the chain of trust from a website up to a root certificate authority, and manage certificates through issuance, renewal and revocation.
- Read a digital certificateIdentify the fields of an X.509 certificate, check which names and uses it covers, and tell validation levels and self-signed certificates apart.
- Follow the chain of trust and the issuance processExplain how root and intermediate certificate authorities form a chain of trust, how a certificate is requested with a CSR and issued, and what keeps certificate authorities honest.
- Manage certificate revocation and lifetimesExplain how CRLs, OCSP and short certificate lifetimes deal with compromised certificates, and keep certificates renewed so they do not expire unexpectedly.
- Read a digital certificate
- Follow a TLS 1.3 connection from the first message to encrypted data, read cipher suites, and diagnose the certificate and configuration problems seen in everyday practice.
- Explain how a TLS connection is set upDescribe what TLS protects, follow the steps of the TLS 1.3 handshake and what each step provides, and read a cipher suite name.
- Verify and troubleshoot TLS in practiceCheck what a browser verifies before it trusts a site, interpret common certificate errors, and recognize practical features and risks such as HSTS, mutual TLS and TLS inspection.
- Explain how a TLS connection is set up
- Protect keys throughout their life with the right tools, and explain why quantum computers threaten today's public-key cryptography and how organizations move to post-quantum algorithms.
- Manage cryptographic keys through their lifecycleGenerate, store, use, rotate, back up and destroy keys safely, and choose between hardware security modules, TPMs, secure enclaves and key management services.
- Explain the quantum threat and post-quantum cryptographyExplain which algorithms a large quantum computer would break, why encrypted data is already at risk, which post-quantum standards replace them, and how organizations plan the migration.
- Manage cryptographic keys through their lifecycle
Cryptography and PKI study guide
1Protect data with symmetric encryption
Encryption protects a stolen drive and an intercepted message in different ways. Start with the key, the secret value that makes protected data readable, then connect the choice of cipher to the place where protection is needed. Comparing disks, database fields and network connections makes it easier to see what each layer stops, and what access remains after someone signs in or a server receives the data.
1.1 Keys, readable data and security goals
Cryptography protects information with mathematical methods. The useful starting question is what protection a situation needs: keeping a message private, detecting a change, identifying its origin or showing that someone signed it.
Match the protection to the goal
| Goal | Meaning | Cryptographic support |
|---|---|---|
| Confidentiality | Only authorized parties can read the data. | Encryption |
| Integrity | Changes can be detected. | A trusted hash comparison, MAC or signature |
| Authentication | A party or message origin is confirmed. | MACs and signatures with trusted keys |
| Non-repudiation | A signer cannot credibly deny signing. | Digital signatures with controlled private keys |
Encryption alone does not identify the sender or reliably detect changes. A plain hash does not identify a sender either: anyone can calculate one. Its expected value must be trusted before a comparison is useful against an attacker.
Follow the data through a cipher
Plaintext is the readable input. A cipher is the encryption algorithm; its key controls the transformation. Encryption produces ciphertext, and decryption with the correct key restores the plaintext. Good encryption hides the message's content, although its length and other surrounding information may still be visible.
The algorithm can be public. Kerckhoffs's principle says security should survive disclosure of everything except the key. AES is published so researchers can examine it. A secret, homemade cipher lacks that sustained scrutiny; keeping its instructions hidden gives no reliable measure of its strength.
Understand what key length buys
A bit has two possible values, so each extra key bit doubles the number of possible keys. Trying possible keys until one works is a brute-force attack.
The old DES cipher has a 56-bit key: about possibilities. At a trillion guesses per second, an exhaustive search takes about 20 hours. A 128-bit key has about possibilities; at that rate, the full search takes about years. An attacker may find a key before the full search finishes, but the difference in scale remains enormous.
Key length and security strength are different measures. Security strength describes the approximate work needed by the best relevant attack. AES-128 offers about 128 bits of classical security; RSA needs about 3,072 key bits to reach similar strength. Comparing their raw key lengths would give the wrong ranking. The 112-bit level is a current minimum in NIST guidance; 128 bits is a common target for new systems.
Separate encryption from rewriting data
Base64 and hexadecimal are encodings: public ways to represent data. For example, YWRtaW46c2VjcmV0 decodes to "admin:secret" without any key. A hash is a one-way fingerprint; there is no decryption operation that restores its input.
Strong encryption also needs protected keys and endpoints. Malware in an unlocked user session can read files as the operating system decrypts them. A key exposed in a configuration file can be stolen without searching the cipher's enormous key space.
Key Takeaways
- Encryption provides confidentiality; MACs and signatures also detect changes and authenticate origin.
- Keep the key secret; use public, examined algorithms.
- Key length is comparable within an algorithm family; security strength compares attack effort.
- Encoding is reversible without a key, while hashing has no decryption operation.
1.2 Shared keys, ciphers and authenticated encryption
Symmetric encryption uses the same secret key to encrypt and decrypt. It is fast enough for large files, disks and network traffic. Everyone who receives the key must protect it, because anyone holding it can decrypt the data.
Choose a current cipher
AES is a block cipher. It processes 128-bit blocks, equal to 16 bytes, whether its key is 128, 192 or 256 bits long. The names AES-128 and AES-256 describe the key, not the block size. ChaCha20 is a stream cipher with a 256-bit key. It generates a keystream that is combined with the plaintext and works well on processors without AES acceleration.
DES's 56-bit key is too short. Triple DES, or 3DES, has a small 64-bit block and is slow; NIST disallowed it for new encryption after 2023. RC4 has statistical weaknesses and is prohibited in TLS. These names in a configuration are reasons to update it.
A mode controls how blocks are processed
| Mode | How it handles data | Main issue or benefit |
|---|---|---|
| ECB | Encrypts each block independently. | Repeated blocks reveal patterns. |
| CBC | Mixes each block with the preceding ciphertext block. | Needs an unpredictable IV and separate authentication. |
| GCM | Builds a keystream from AES and produces an authentication tag. | Protects secrecy and integrity together. |
With ECB, identical plaintext blocks under one key produce identical ciphertext blocks. Even an encrypted picture can retain visible outlines. CBC hides those repetitions, but CBC encryption by itself does not reliably detect deliberate changes.
Authenticated encryption with associated data, or AEAD, protects confidentiality and integrity together. AES-GCM and ChaCha20-Poly1305 are common choices. The receiver checks an authentication tag and rejects data that fails verification. Associated data, such as a visible header, can be authenticated without being encrypted. TLS 1.3 uses AEAD ciphers.
Keep each nonce unique for its key
A nonce is a non-secret value sent or stored with the ciphertext. In GCM and ChaCha20-Poly1305, never reuse it with the same key. Reuse can expose relationships between plaintexts and undermine authentication. Calling a nonce public does not make its uniqueness optional. CBC instead requires an unpredictable initialization vector, or IV.
Work through a message's size
Take a 100-byte message. AES-CBC with PKCS#7 padding fills seven 16-byte blocks: 112 ciphertext bytes. The padding adds 12 bytes, and the 16-byte IV is extra, making 128 bytes before any separate authentication.
AES-GCM needs no block padding. With a 12-byte nonce and 16-byte tag, it stores 100 ciphertext bytes plus 28 bytes of overhead: 128 bytes total. Equal final sizes here do not mean equal protection: the GCM tag detects tampering.
Sharing the key is the scaling problem
If every pair in a group needs its own secret, the number of keys is . Ten people need 45 keys; 100 need 4,950. Public-key methods help establish these secrets without delivering each one through a preexisting private channel.
AES-256 has twice the key length of AES-128, but far more than twice the possible keys. It offers additional long-term margin; it cannot repair nonce reuse or an exposed key.
Key Takeaways
- Symmetric ciphers use one shared secret and efficiently encrypt bulk data.
- AES always has a 128-bit block; its key can have 128, 192 or 256 bits.
- Prefer AEAD protection such as AES-GCM or ChaCha20-Poly1305.
- Never reuse a GCM or ChaCha20-Poly1305 nonce with the same key.
- Pairwise shared secrets scale as n(n − 1)/2.
1.3 Where encryption protects data
Encryption must sit where it can stop the attacker you are concerned about. A stolen storage device, a database query and an intercepted network packet expose data at different places.
Follow the three data states
Data at rest is stored in files, databases and backups. Data in transit moves between systems. Data in use is being processed in memory. Storage encryption protects the first state; transport encryption such as TLS protects the second. Hardware-isolated processing areas and confidential computing can protect data in use within a defined protected boundary.
Compare storage layers
| Layer | What it encrypts | Important boundary |
|---|---|---|
| Full-disk encryption | An entire drive, including temporary files and swap. | Protects a powered-off stolen device; the running user session can read files. |
| Partition or volume encryption | A selected storage area or container. | Other volumes may remain unencrypted. |
| File-level encryption | Individual files or folders. | Protection can travel with an encrypted file when copied. |
| Transparent data encryption | Database files and backups on disk. | Accepted database queries still return plaintext. |
| Application-side field encryption | Selected values before database storage. | Protects them from query users who lack keys and decryption access. |
BitLocker, FileVault and LUKS are full-disk encryption systems. An encrypted archive is a file-level example. With transparent data encryption, or TDE, the application does not change because the database encrypts its underlying files. A database administrator who can query those files through the engine may still read the records.
Field-level encryption can place a stronger boundary around selected values. The application encrypts them before storage, and key access stays outside the database administrator's control. An authorized application can still decrypt. The location of the keys and the permissions to use them determine who is excluded.
Protect the connection and identify its ends
TLS protects websites, APIs and email connections; SSH protects remote administration; IPsec and TLS-based tunnels protect VPN traffic; WPA3 protects the Wi-Fi link. Each protects traffic between its own endpoints. A service that terminates a TLS connection reads the request after decryption.
With end-to-end encryption, the communicating users' devices hold the keys, while relay servers handle ciphertext. A messaging service using this design cannot read message contents simply by receiving them. TLS to a service does not by itself provide that same boundary.
Build layers for a clinic
First, full-disk encryption protects a staff laptop left on a train while powered off. Next, TDE protects database files and backups copied from storage. Application-side encryption protects selected patient fields from query users without decryption access. Finally, TLS protects requests between the clinic app and server. The layers address different exposures; database encryption alone does not stop SQL injection that causes an accepted query to return readable data.
Recognize other ways to hide information
Masking limits what is displayed, such as "•••• •••• •••• 4821". Tokenization replaces a sensitive value with a token and holds the original in a protected vault. Steganography hides a message's presence inside another file, such as an image. None of these terms means the data has been encrypted; a hidden message can still be readable once found.
Key Takeaways
- Choose encryption by the data state and the attacker it stops.
- Full-disk encryption and TDE protect stored files, while accepted sessions and queries can expose plaintext.
- Application-side field encryption needs keys and decryption access outside the excluded users’ control.
- End-to-end encryption keeps message keys on the communicating users’ devices.
- Masking, tokenization and steganography serve different purposes from encryption.
- Protect storage and transport separately.
2Use asymmetric cryptography and key exchange
A public key can be shared openly while its partner stays private. That change makes secure communication practical between people who have never exchanged a secret. Learn which key encrypts or signs, then follow how a key agreement produces a temporary shared secret. Real systems combine these public-key operations with fast symmetric encryption, so trust in a public key matters as much as the mathematics linking the pair.
2.1 Public keys, private keys and their jobs
A public-key system gives each owner two mathematically linked keys. The public key is shared; the private key remains under the owner's control. With secure algorithms and suitable key sizes, computing the private key from the public one is infeasible.
Choose the key by the task
| Task | Key used first | Key used by the receiver or verifier |
|---|---|---|
| Encrypt a secret to Bob | Bob's public encryption key | Bob's private decryption key |
| Sign data as Alice | Alice's private signing key | Alice's public verification key |
For confidentiality, aim at the recipient: only that recipient should decrypt. For signing, identify the sender: only that signer should create the signature. Not every public-key algorithm supports both operations; use keys and algorithms intended for the job.
Alice wants to send Bob a confidential, signed contract. First she signs with her own private signing key. She then protects the signed material for Bob using his public encryption key, normally through hybrid encryption. Bob decrypts with his private key and verifies with Alice's public key. Alice never needs Bob's private key.
Encrypting to Alice's own public key would let Alice decrypt, not Bob. Encryption to Bob also says nothing about the sender, because everyone can obtain Bob's public key. Sharing a signing private key among several people weakens evidence about which person signed.
Compare algorithm families fairly
RSA relies on the difficulty of factoring a very large product of primes. RSA-2048 offers about 112 bits of classical security; RSA-3072 offers about 128. RSA supports signature schemes and can encrypt small secrets with an appropriate encryption scheme.
Elliptic-curve cryptography, or ECC, achieves comparable strength with smaller keys. P-256 and Curve25519-based methods provide roughly 128-bit classical security. ECDSA and EdDSA, including Ed25519, produce signatures; ECDH and X25519 establish shared secrets. The smaller values reduce storage and transmission costs and help small devices.
A 256-bit elliptic-curve key and a 256-bit AES key do not have the same security strength. The mathematical problem and best attack matter, so compare published security strengths instead of counting key bits across families.
Keep bulk data out of RSA operations
Public-key operations are slower than symmetric encryption. They also have format limits. An RSA-2048 key occupies 256 bytes, but RSA-OAEP with SHA-256 can encrypt at most 190 bytes at once because padding consumes space. It cannot directly encrypt a large video in one operation. Public-key systems protect or establish a small symmetric key; that key handles the file.
Open distribution creates a trust question
One hundred people can each publish a public key and protect one private key: 100 pairs instead of 4,950 pairwise shared secrets. But a key labeled "Bob" could have been substituted by an attacker. A certificate provides a signed identity-to-key binding that a receiver can validate.
RSA and elliptic-curve methods face a future threat from sufficiently powerful quantum computers running Shor's algorithm. Post-quantum replacements address that public-key problem; publishing the public key was never the mistake.
Key Takeaways
- Encrypt for the recipient with the recipient’s public encryption key.
- Sign with the signer’s private key; verify with the signer’s public key.
- RSA-3072 and a 256-bit elliptic-curve key provide roughly 128-bit classical security.
- Public-key cryptography establishes keys and signs; symmetric encryption handles bulk data.
2.2 Agreeing on a secret and using it efficiently
Two systems can establish a shared secret across an open network without sending that secret as readable data. The public messages support a mathematical exchange; the private values remain at the endpoints.
Follow Diffie–Hellman key agreement
Each side generates a private value and a related public value. They exchange public values. Alice combines her private value with Bob's public value; Bob combines his private value with Alice's public value. Both calculations produce the same secret. An eavesdropper with only the public values cannot feasibly reproduce it.
A paint analogy shows the pattern: begin with public yellow, mix in private red or blue, exchange the mixtures, then add the private color again. Both sides finish with yellow, red and blue. The useful feature is easy mixing and difficult reversal; actual key agreement uses mathematics, not colors.
Diffie–Hellman is often shortened to DH; its elliptic-curve form is ECDH. A key derivation function, or KDF, takes the resulting secret and produces usable session keys, including different keys for each traffic direction.
Add authentication to stop substitution
Bare DH does not tell Alice who supplied the public value. An on-path attacker can establish one secret with Alice and another with Bob, then relay altered traffic between them. Authentication binds the exchange to the intended party. In a certificate-authenticated TLS connection, the server signs the handshake with the private key corresponding to its certificate.
Make the exchange temporary
Ephemeral means used for one session. DHE and ECDHE generate fresh exchange keys and discard their private values after use. This supports forward secrecy: stealing the server's long-term signing key later does not reveal past session keys from recorded traffic, provided the temporary secrets have been erased.
Older RSA key transport protected a session secret directly with the server's long-term RSA key. A later theft of that private key could unlock recorded exchanges. TLS 1.3 removed RSA key transport. An RSA certificate can still authenticate a TLS 1.3 handshake; the certificate's algorithm does not dictate the exchange method.
Establish a key through encapsulation
A key encapsulation mechanism, or KEM, creates a shared secret and an encapsulation ciphertext using the recipient's public key. The recipient uses the matching private key to recover the same secret. ML-KEM is a post-quantum example. Key establishment is the overall task; agreement and encapsulation are different ways to perform it.
Work through hybrid encryption
An OpenPGP message contains a 50 MB video for three recipients:
- Generate one random 256-bit symmetric session key, equal to 32 bytes.
- Encrypt the video once with that key.
- Protect the session key separately for each recipient with that recipient's public key.
- Send one encrypted video and three small protected-key entries.
Each recipient opens their own key entry and uses the recovered session key on the same ciphertext. TLS, encrypted email and file-encryption tools combine public-key operations with symmetric encryption in this way. This meaning of hybrid encryption differs from a hybrid post-quantum exchange, which combines two key-establishment algorithms.
Key Takeaways
- Key agreement produces a shared secret without sending that secret in plaintext.
- A KDF turns the shared secret into usable session keys.
- Authenticate the exchange to prevent an on-path attacker from substituting keys.
- Fresh, erased ephemeral secrets support forward secrecy.
- Hybrid encryption protects bulk data once and establishes or protects its symmetric key separately.
3Verify integrity with hashing and digital signatures
A file can stay readable while still carrying evidence of a change or of who signed it. Hashes, password-hashing functions and digital signatures make different promises. Start by checking a file against a trusted digest, then see why password storage needs unique salts and costly guesses. Finally, connect a signature to the private key that created it and distinguish that evidence from a shared-key authentication code.
3.1 File fingerprints and trusted comparisons
A cryptographic hash function takes input of any size and produces a fixed-size digest, or fingerprint. The same bytes always give the same digest. SHA-256 produces 256 bits, normally written as 64 hexadecimal characters, for a single letter or a 4 GB file.
Understand the three resistance properties
| Property | What must be hard to find |
|---|---|
| Preimage resistance | An input matching a given digest. |
| Second-preimage resistance | A different input matching one particular input's digest. |
| Collision resistance | Any two different inputs with the same digest. |
These are different search tasks. Collision resistance does not mean collisions are mathematically impossible. Infinitely many inputs map into a finite set of digests; security means finding a useful collision is infeasible.
The avalanche effect makes a small input change alter the output dramatically. The SHA-256 digest of "Meet at 10:00" begins 05b7dd87a866; "Meet at 10:01" begins 568c89f30171. Similar-looking messages do not need similar-looking digests. These prefixes illustrate the change; an integrity check compares the complete digest.
Separate guessing from decryption
There is no hash decryption key. An attacker who recovers a weak password from its digest usually guesses candidate passwords, hashes them and looks for a match. The hash function has not reversed itself. Predictable inputs make guessing practical even when a general preimage attack is infeasible.
SHA-2, including SHA-256, SHA-384 and SHA-512, and SHA-3 are current hash families. MD5 and SHA-1 have practical collision attacks and must not secure signatures, certificates or integrity checks against deliberate attackers. CRC32 is a non-cryptographic checksum intended to catch accidental damage; an attacker can deliberately preserve it while changing a file.
Why output length matters
A birthday comparison asks whether any pair matches, not whether someone matches one chosen birthday. In a group of 23 people, the chance of a shared birthday is about 51%. The same counting effect makes a generic collision search against an n-bit hash take about attempts.
SHA-256 therefore offers about 128 bits of collision resistance. A 128-bit digest would offer at most 64 bits even without a special weakness. Its output length cannot be read directly as its collision security strength.
Check a downloaded installer
First obtain the publisher's expected SHA-256 digest through a trusted channel. Then compute the downloaded file's digest, for example with sha256sum installer.iso on Linux or Get-FileHash .\installer.iso -Algorithm SHA256 in PowerShell. Compare every character of the full result.
A mismatch means the file differs, through damage or alteration. A match against an authentic expected digest gives strong evidence that the file is the publisher's version. If an attacker controls both the file and the displayed digest, they can publish a matching replacement pair. A verified publisher signature or a separately trusted digest is needed to establish the reference.
Key Takeaways
- A hash is deterministic and fixed in size; it has no decryption operation.
- Preimage, second-preimage and collision resistance describe different search tasks.
- SHA-256 offers about 128 bits of generic collision resistance.
- Compare the full digest against an authentic expected value.
- Use SHA-2 or SHA-3 for cryptographic hashing; MD5, SHA-1 and CRC32 do not provide suitable protection against deliberate alteration.
3.2 Password storage that makes guessing expensive
A service needs to check a password at login without keeping a recoverable copy. It stores the output of a password-hashing function, together with the salt and the settings needed to repeat the calculation. At login, it applies the same process to the entered password and compares the result.
What happens after a database theft
With stolen password hashes, attackers can guess offline without triggering the service's login limits. Dictionary attacks try common words and leaked passwords; brute force tries combinations. Precomputed lookup tables, including rainbow tables, can recover many unsalted passwords cheaply. Identical unsalted inputs also reveal which accounts share a password.
A salt is a fresh random value generated separately for each password, commonly 16 bytes. It is combined with the password and stored openly beside the result. Two people using the same password then have different stored values, and an attacker cannot reuse one precomputed table for all accounts.
For illustration, combining "Sunflower42" with salt a91f3c07 gives a SHA-256 digest beginning ae5af2e9a0fa; salt 5be20d94 gives 8905614528a4. A production password system uses a slow password-hashing function, not a single SHA-256 pass. The example isolates what the salt changes.
Add a work cost to every guess
A salt prevents shared lookup work; it does not make one guess expensive. An attacker knows the salt and can test a candidate against it. Key stretching adds a tunable time cost, and memory-hard functions also require memory for each guess.
Argon2id is OWASP's preferred choice. One minimum configuration uses 19 MiB of memory, two iterations and parallelism of one. Other options include scrypt, bcrypt for legacy systems, and PBKDF2. Where the relevant compliance requirements call for it, OWASP specifies PBKDF2-HMAC-SHA256 with at least 600,000 iterations. Benchmark the chosen settings so legitimate logins remain usable while each guess costs meaningful resources.
A simplified calculation shows the scale. Suppose a fast hash allows 10 billion guesses per second and a password function costs 600,000 times as much. The rate becomes about 16,700 guesses per second. A billion-candidate list takes about 16.7 hours instead of 0.1 seconds. This is an illustrative cost ratio, not a hardware benchmark or a guarantee that every PBKDF2 iteration equals one SHA-256 operation.
Keep a pepper separate
A pepper is an extra secret shared across a password system and kept outside the password database, such as in a secrets vault or HSM. It helps if the database alone is stolen. Unlike a salt, the pepper must remain secret. It supplements unique salts and key stretching.
| Value | Secret? | Role |
|---|---|---|
| Salt | No | Makes stored results unique and prevents reusable lookup tables. |
| Pepper | Yes | Adds a secret outside the stolen database. |
| Work and memory settings | No | Set the resource cost of each password guess. |
The same kind of slow derivation can turn an archive passphrase into an encryption key. Neither use rescues an extremely weak password: "123456" is cheap to find because it appears near the start of guessing lists. Reversible password encryption also creates a recovery key that an attacker could steal.
Key Takeaways
- Store passwords with a dedicated password-hashing function, not plaintext or reversible encryption.
- Generate a different random salt for each password; the salt is public.
- Key stretching raises the cost of each guess; salting blocks reusable lookup work.
- Keep a pepper outside the password database.
- Slow storage still needs strong passwords.
- A stored password record needs the algorithm settings and salt so login verification can repeat the calculation.
3.3 Digital signatures and shared-key authentication
A digital signature binds data to a private signing key. Anyone with the matching, trusted public key can verify it. The data can stay completely readable: a signature provides integrity and origin evidence, not confidentiality.
Follow signing and verification
For RSA-PSS and ECDSA, a useful conceptual sequence is:
- Hash the data.
- Use the private key and the signature algorithm to produce a signature over that digest.
- Send the data and signature together.
- The receiver hashes the received data and checks the signature with the public key.
Ed25519 instead takes the message and performs its specified hashing internally. Do not substitute an improvised "hash first" procedure for an algorithm's defined interface. A changed message or signature will fail verification except with negligible probability under secure use.
A software publisher signs an installer. The operating system checks the signature with the publisher's public key. If someone modifies the signed file, the check fails. A valid check shows that the signed bytes match what that private key signed; it does not establish that the program is harmless.
Common signature schemes include RSA-PSS, older RSA PKCS#1 v1.5 signatures, ECDSA and EdDSA such as Ed25519. ML-DSA and SLH-DSA are post-quantum signature algorithms.
Compare a signature with an HMAC
A message authentication code, or MAC, uses a shared secret. HMAC combines that secret with a hash function and authenticates the message. The receiver can detect alteration and know that someone holding the shared key created the code.
| Feature | HMAC | Digital signature |
|---|---|---|
| Creation key | Shared secret | Signer's private key |
| Verification key | Same shared secret | Signer's public key |
| Independent verification | A verifier with the secret can also create codes. | A verifier can check without being able to sign. |
| Non-repudiation support | No: either holder could create the code. | Yes, when control of the signing key is reliable. |
Non-repudiation depends on key control. If a signing key is stolen or shared, a valid signature cannot reliably identify the individual who performed the operation. Hardware protection and prompt revocation help preserve that evidence. A scanned handwritten signature offers no cryptographic check on changes to the document.
Recognize signatures in everyday systems
A CA signs a certificate. A TLS server signs a handshake. Publishers sign updates; S/MIME and OpenPGP sign email; DKIM signatures let mail servers check domain authorization of a message. Each needs trust in the verification key and a clear understanding of what was signed.
A blockchain links blocks by placing the previous block's hash in the next block. Altering an old block breaks the later hash links unless they are rebuilt. Public ledgers also use distributed copies and consensus rules to make rewriting accepted history difficult. Transaction signatures authorize actions under their keys. Hash links alone neither establish consensus nor make every recorded claim true, and transaction-signing rules depend on the ledger's design.
Key Takeaways
- Sign with a private key and verify with the matching, trusted public key.
- A signature protects integrity and origin evidence while leaving the message readable.
- HMAC holders share a secret, so an HMAC cannot distinguish which holder created it.
- Non-repudiation relies on exclusive control of the private signing key.
- A valid signature does not certify that signed content is true or safe.
- Blockchain hash links reveal changes; distributed validation governs which history is accepted.
4Trust public keys with certificates and PKI
A public key needs an identity you can trust. Certificates supply signed bindings, and PKI supplies the people, systems and procedures that issue and withdraw them. Read the names and limits in a certificate, then trace its signatures to a trusted root. Issuance, installation, renewal and revocation belong to the same working system: a correctly issued certificate can still cause an outage if its chain is incomplete or its replacement arrives late.
4.1 Names, purposes and dates in a certificate
A digital certificate is a signed binding between an identity and a public key. A certificate authority, or CA, signs it. Most use the X.509 version 3 format. The certificate is public information and contains the public key, never the private key.
Read the fields before trusting the name
The subject identifies the holder; the issuer identifies the signing CA. A serial number distinguishes this certificate within that issuer's certificates and supports revocation. Not Before and Not After bound its validity. The certificate also contains the subject's public key, extensions, and the CA's signature and signature algorithm.
For website names, read Subject Alternative Name, or SAN. A browser compares the hostname in the address with the SAN entries. The older Common Name field alone is not enough for modern public website validation.
| Certificate entry | Covered name | Name not covered by this entry |
|---|---|---|
shop.example.com | shop.example.com | www.shop.example.com |
*.example.com | shop.example.com or mail.example.com | example.com or eu.shop.example.com |
A wildcard covers one subdomain level. Add the bare domain separately if it is needed. Deploying the same wildcard certificate and private key across many servers broadens the impact if one of those key copies is stolen.
Check the permitted use
Key Usage lists operations such as signing or key encipherment. Extended Key Usage, or EKU, lists purposes such as server authentication, client authentication, code signing or email protection. Basic Constraints indicates whether the holder is a CA. A certificate that proves a device's identity for client authentication is not automatically suitable for signing software.
Compare identity checks, not encryption strength
DV certificates establish domain control. OV also checks the organization's legal existence; EV applies stricter identity checks. These validation levels do not change the encryption strength, and current browsers do not prominently highlight EV identity in the address bar.
A self-signed certificate has a signature made with its own private key. That signature does not supply an independent identity check. A browser needs explicit trust configuration to accept it. Public sites normally use a publicly trusted third-party CA. Internal services can use a private CA whose root is installed on managed devices.
Work through a date and name check
A certificate lists shop.example.com and www.shop.example.com in SAN and permits server authentication. Its validity runs from April 10 to October 26, 2026. On November 2, the names still match but the certificate has expired. Before expiry it still cannot authenticate checkout.example.com: an acceptable date cannot add a missing name.
Recognize the container
PEM stores a certificate as Base64 text between -----BEGIN CERTIFICATE----- and -----END CERTIFICATE-----. DER stores the certificate in binary. A PKCS#12 bundle, commonly .p12 or .pfx, can include a private key as well as certificates, so protect it with a strong password and controlled access. A certificate fingerprint is a hash identifying the exact certificate; it is different from the CA's signature on it.
Key Takeaways
- A certificate binds an identity to a public key and never contains the private key.
- Match website hostnames against SAN entries, including wildcard depth.
- Check the validity period and allowed purpose separately.
- DV, OV and EV differ in identity validation, not encryption strength.
- A PKCS#12 bundle may contain a private key even though a certificate itself does not.
4.2 Trust chains and certificate issuance
Public key infrastructure, or PKI, includes certificate authorities, identity checks, trust stores, revocation services, policies and operational procedures. A registration authority checks the requester's identity before the CA issues a certificate; the roles can be part of the same organization.
Trace a chain back to a trusted root
A website usually presents a leaf certificate signed by an intermediate CA. The intermediate's certificate is signed by a root CA. The client uses each issuer's public key to check the signature below it and builds a path to a root already trusted in its trust store.
The root's self-signature does not create that trust. Operating systems, browsers or an organization's administrators decide which roots to install. Trust starts with that decision and flows down through validated signatures and certificate constraints.
The server sends its leaf and the necessary intermediate certificates. It normally need not send the root already in the client's store. A missing intermediate can produce "unable to get local issuer certificate" even when the leaf is correctly issued. One browser may have a cached intermediate while another client does not.
Root private keys are usually kept offline in HSMs and used sparingly. Intermediate CAs handle routine issuing. If an intermediate is compromised, it can be withdrawn and replaced without replacing the root on every device.
Request a certificate without sending the private key
- Generate the key pair where the private key will be protected.
- Create a certificate signing request, or CSR, containing the public key and requested names. Its signature proves possession of the private key.
- Send the CSR to the CA.
- Complete domain-control checks and any organization checks required for OV or EV.
- Receive the CA-signed certificate.
- Install it with its matching private key and intermediate chain.
The private key stays with its owner. This command creates an RSA-3072 key and a request for two hostnames:
openssl req -new -newkey rsa:3072 -noenc -keyout shop.key -out shop.csr -subj "/CN=shop.example.com" -addext "subjectAltName=DNS:shop.example.com,DNS:www.shop.example.com"
Only shop.csr goes to the CA. The -noenc option leaves shop.key unencrypted, so restrict its file permissions and access. The names requested in a CSR still need CA validation; the CSR alone is not a trusted certificate.
Automate issuance and watch for mistakes
ACME automates domain validation, issuance and renewal. An HTTP-01 challenge serves a token at the website; DNS-01 publishes a DNS TXT record. An ACME client such as Certbot performs the workflow and installs renewed certificates.
Certificate Transparency, or CT, records public TLS certificates in public append-only logs. Domain owners monitor the logs for unexpected issuance. A DNS CAA record names the CAs authorized to issue for a domain. Root programs can remove a CA from trust stores after serious failures, as happened with DigiNotar after its 2011 breach.
A private PKI issues certificates for internal devices, Wi-Fi, VPNs and users. Its root is distributed to managed clients.
Key Takeaways
- Trust starts at an installed root and follows valid signatures through intermediates to a leaf.
- Servers must provide the intermediates needed by their clients.
- Send the CSR to the CA and keep the private key protected.
- ACME automates validation, issuance and renewal.
- CT logs expose unexpected public issuance; CAA records restrict authorized issuers.
- Private PKI requires distributing its root to the intended clients.
4.3 Revocation, expiry and reliable renewal
Expiry is a planned end date. Revocation withdraws trust earlier because of a problem such as key theft, incorrect identity information or misissuance. The CA records the affected certificate's serial number and reason. Revocation does not remove the certificate from the server; clients need current status information.
Compare status mechanisms
| Mechanism | What happens | Practical trade-off |
|---|---|---|
| CRL | A client downloads a signed list of revoked serial numbers. | Lists need regular updates. |
| OCSP | A responder returns signed status for a particular certificate. | Adds requests, delay and privacy concerns. |
| OCSP stapling | The server sends a recently obtained signed OCSP response. | Avoids a separate client-to-responder request. |
A certificate revocation list, or CRL, is published at distribution points identified in the certificate. Public TLS CA rules require CRLs; OCSP service is optional. An OCSP answer can be "good", "revoked" or "unknown". Unknown is not good, and an unavailable responder does not establish that a certificate is safe.
Some clients continue when a live status request fails, known as a soft fail. Browsers also use compact revocation information downloaded in the background. These mechanisms have different coverage and freshness, so browser acceptance is not a guarantee of complete real-time revocation knowledge. Let's Encrypt ended its OCSP service in 2025 and uses CRLs.
Read the lifetime schedule by issuance date
Short lifetimes limit how long an already issued certificate can remain usable, but they do not remove the need to respond to key theft. For publicly trusted TLS server certificates, the maximum lifetime is:
| Issued on or after | Issued before | Maximum validity |
|---|---|---|
| March 15, 2026 | March 15, 2027 | 200 days |
| March 15, 2027 | March 15, 2029 | 100 days |
| March 15, 2029 | No later boundary in this schedule | 47 days |
The applicable limit follows the issuance date. A certificate issued on November 1, 2026 can run for at most 200 days, to May 20, 2027. It does not become a 100-day certificate merely because March 15, 2027 arrives during its lifetime. Private CA certificates are outside these public TLS limits. Domain-validation reuse also shrinks, reaching 10 days in 2029.
With 47-day certificates, even renewal at the last moment requires about 7.8 renewals per year. Renewing earlier increases that frequency. ACME automation, successful-installation checks and expiry alerts prevent manual work from becoming a source of outages.
Respond to compromise and maintain an inventory
On suspected private-key compromise, revoke the affected certificate, generate a fresh key pair, obtain and install a certificate for that new key, and investigate the leak. Reissuing against the stolen key leaves the attacker holding a usable credential.
Record each certificate's owner, service, installation location, issuer and expiry. Monitor renewal and deployment, not just the request to the CA. Alerts well before expiry give time to fix failures. If many certificates appear expired on just one device, check its clock as well as the certificates' dates.
Key Takeaways
- Revocation withdraws trust early; expiry ends a certificate’s stated validity.
- CRLs and OCSP provide signed status information, with client-specific freshness and availability limits.
- Public TLS lifetime limits depend on issuance date: 200, then 100, then 47 days.
- A compromised private key needs replacement as well as certificate revocation.
- Inventory, automated renewal and deployment checks prevent avoidable outages.
5Secure connections with TLS
An HTTPS connection brings the earlier pieces together: keys, signatures, certificates and authenticated encryption. Follow the TLS 1.3 handshake to see when each piece is used, then diagnose failures by the specific check that failed. The same model explains why an encrypted connection can still reach a phishing site, why a redirect cannot repair a bad certificate, and how a company proxy can inspect traffic from a managed device.
5.1 From the first hello to encrypted application data
Transport Layer Security, or TLS, protects data between a client and a server. It supplies confidentiality, integrity and server authentication; client authentication is optional. HTTPS is HTTP over TLS, normally using port 443. The name "SSL certificate" persists, but SSL is an insecure predecessor, not the protocol to enable.
Follow a certificate-authenticated TLS 1.3 handshake
- The client sends ClientHello, listing supported versions, cipher suites and public key shares. It also supplies a random value and usually the requested server name through SNI.
- The server sends ServerHello with its choices and key share. Both endpoints compute shared secrets and derive handshake keys.
- Under those handshake keys, the server sends its certificate chain, CertificateVerify, and Finished. CertificateVerify is a signature binding the server's private key to the handshake transcript. Finished is a keyed check over that transcript.
- The client validates the certificate and signature, checks Finished and sends its own Finished. Application traffic uses separately derived application keys.
A normal full TLS 1.3 handshake needs one round trip before the client sends application data. The exchange establishes secrets; the certificate and signature authenticate the server; Finished detects changes to the negotiation; AEAD protects the application records. A certificate alone would not prove that this connected server holds its private key.
Read the cipher suite at the right version
| Version | Example | What the name states |
|---|---|---|
| TLS 1.2 | TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 | ECDHE exchange, RSA authentication, AES-128-GCM data protection, SHA-256 key derivation. |
| TLS 1.3 | TLS_AES_128_GCM_SHA256 | AES-128-GCM and SHA-256; exchange and signature are negotiated separately. |
Other common TLS 1.3 suites are TLS_AES_256_GCM_SHA384 and TLS_CHACHA20_POLY1305_SHA256. An RSA certificate does not imply old RSA key transport. A TLS 1.2 suite starting TLS_RSA_WITH_ does use that older transport and lacks forward secrecy.
Offer TLS 1.3 and strong TLS 1.2 configurations. TLS 1.0 and 1.1 were deprecated in 2021; SSL 2.0 and 3.0 are prohibited. RC4, 3DES, NULL, EXPORT and anonymous suites are warning signs. Disable obsolete choices so an attacker cannot negotiate them. TLS 1.3 also authenticates the negotiation and uses downgrade markers to detect certain attempts to force an older version.
Treat early data as replayable
A returning client can resume using a pre-shared key. Optional 0-RTT early data arrives before the handshake completes and can be replayed by an attacker. Accept it only for application operations designed to remain safe when repeated. A payment or account-changing action must not rely on early data being delivered just once.
TLS does not hide IP addresses, traffic size or timing. DNS and SNI can also remain visible unless separately protected. It ends at the connection endpoints, so it does not encrypt the server's stored files or protect plaintext from malware already running on an endpoint.
Key Takeaways
- The handshake establishes secrets and authenticates the peer before normal application traffic.
- CertificateVerify proves private-key possession over the handshake; Finished checks the transcript.
- TLS 1.3 cipher suite names omit the separately negotiated exchange and signature algorithms.
- Disable obsolete protocols and weak suites.
- 0-RTT data is replayable and needs application-specific restrictions.
- TLS protects the connection, with metadata and endpoint limits.
5.2 Checking certificates and fixing TLS failures
A successful TLS connection depends on several independent checks. Read a warning as a clue about one of those checks, then fix its cause.
Check the identity and the trust path
The client builds a chain to a trusted root and validates its signatures and constraints. It checks dates, matches the requested hostname to SAN, checks the permitted use and consults available revocation information. It also verifies the server's handshake signature. A known revocation is grounds for rejection; client status mechanisms differ in coverage and freshness.
| Common Chrome error | Likely check to investigate |
|---|---|
NET::ERR_CERT_DATE_INVALID | Certificate dates and device clock. |
NET::ERR_CERT_COMMON_NAME_INVALID | Requested hostname against SAN. |
NET::ERR_CERT_AUTHORITY_INVALID | Trusted root, missing intermediate or private/self-signed issuer. |
NET::ERR_CERT_REVOKED | Reported certificate revocation. |
For https://example.org, a certificate listing only www.example.org fails name matching. Reissue with both names. A redirect to the www address is received only after TLS validation, so the redirecting HTTPS address needs its own valid name coverage too.
If a browser succeeds but an app reports "unable to get local issuer certificate", inspect the chain sent by the server. A browser may have cached an intermediate the app lacks. Serve the leaf with its intermediate chain. The browser certificate viewer and openssl s_client -connect example.org:443 -servername example.org help reveal what the server presents.
Separate a protected connection from a trustworthy business
A secure-connection indicator means the connection is encrypted and the server demonstrated the relevant certificate key for the validated hostname. A phishing operator can obtain a DV certificate for a look-alike domain they control. Check the actual address and the request being made, not just the connection indicator.
Keep HTTP from becoming a weak first step
HSTS, HTTP Strict Transport Security, tells browsers to use HTTPS for a domain. For example, Strict-Transport-Security: max-age=31536000; includeSubDomains sets a 365-day policy including subdomains. A browser that knows the policy upgrades HTTP requests and blocks click-through on certificate errors.
A learned policy starts only after the browser receives it over a valid HTTPS connection. Preloading supplies the rule before a first visit, closing the initial plain-HTTP opportunity used in SSL stripping. Deploy HSTS only when the included hostnames can consistently serve valid HTTPS.
Recognize mutual TLS and inspection
Mutual TLS, or mTLS, also requires a client certificate and proof of its private key. It authenticates both sides and is useful for service APIs and managed devices. Client certificates need issuance, rotation and revocation just like server certificates.
A TLS inspection proxy creates two connections: device to proxy, then proxy to server. A company root installed on managed devices lets the proxy issue replacement certificates, decrypt requests for inspection and encrypt them again. That root's signing key is sensitive; inspection can conflict with certificate pinning and expose private content.
For a service, enable strong TLS versions and AEAD suites, install correct SAN coverage and the full chain, automate renewal, configure HTTPS redirects and HSTS, and restrict access to the private key.
Key Takeaways
- Diagnose the failed check: date, name, trust path, purpose or revocation.
- An HTTPS redirect needs valid TLS at the redirecting hostname.
- HSTS protects requests once learned; preloading establishes it before a first visit.
- mTLS authenticates clients as well as servers.
- An inspection proxy terminates TLS and opens a second connection.
6Manage keys and prepare for post-quantum cryptography
Cryptography remains dependable only while its keys are protected, recoverable when needed and retired at the right time. Compare the tools that hold keys, then follow a stored file through envelope encryption and rotation. Long-term planning adds another task: locating public-key methods that quantum computers could threaten. A migration plan starts with the data’s required secrecy lifetime and the systems that will still be running years from now.
6.1 Protecting keys from creation to destruction
A strong algorithm is only one part of a working system. Key management follows keys through generation, distribution, storage, use, rotation, backup, recovery, revocation, archiving and destruction.
Generate unpredictably and limit access
Use a cryptographically secure random generator. A key derived from the time of day or a guessable password has less effective protection than its nominal length suggests. Suitable examples include AES-256, RSA-3072 and P-256 keys. Generate private keys where they will be protected so fewer copies need to move between systems.
Apply least privilege and separation of duties. A database administrator should not automatically administer its encryption keys. Critical operations can require M of N control, such as any three of five custodians acting together. That is different from giving all five people an independent copy of the signing key.
Choose the tool by its job
| Tool | Main role |
|---|---|
| Hardware security module, HSM | Holds keys and performs cryptographic operations within a protected device. |
| Trusted Platform Module, TPM | Protects device-bound keys and supports checks on boot measurements. |
| Secure enclave | Isolates sensitive processing and key operations from the main operating system. |
| Key management service, KMS | Centrally controls key access, operations, rotation and audit records. |
| Secrets manager | Supplies passwords, API credentials and other application secrets at run time. |
An HSM can keep a CA's signing key from leaving in plaintext. A TPM can help BitLocker release a disk key when measured boot conditions match. Secure enclaves protect selected operations within a hardware-defined boundary. A KMS often uses HSMs behind its service, but its access policy still determines who can request decryption.
Work through envelope encryption
A storage service generates a separate data encryption key, or DEK, for a file and encrypts the file with AES-256. It then wraps that DEK using a key encryption key, or KEK, controlled by a KMS. The encrypted file and wrapped DEK can be stored together; the usable KEK stays separately protected.
To read, the application requests a KMS unwrap operation. The KMS checks permissions and logs use; the returned DEK decrypts the file. Rotating the KEK can mean rewrapping the small DEKs while leaving the large file ciphertexts unchanged. Rotating a DEK instead requires re-encrypting its data.
Disabling a KEK blocks new unwrap operations. Previously decrypted copies or cached plaintext DEKs require their own controls; disabling a key cannot erase plaintext already released.
Plan recovery and retirement
A cryptoperiod is the authorized use period. Rotate according to policy and respond immediately to suspected compromise. Keep old decryption keys available for data that still needs them. A lost key can mean permanent loss of otherwise intact files.
Escrow places a recovery copy with a separate trusted function. Protect that copy with strict permissions, logging and dual control. Signing keys are usually replaced when lost instead of escrowed: extra signing copies weaken individual accountability.
Cryptographic erasure, or crypto-shredding, destroys every usable key copy, including backups and escrow, so remaining ciphertext cannot be decrypted. It depends on eliminating alternate recovery paths and usable key copies. Keep inventories, remove hard-coded secrets from code, and avoid using one key for unrelated purposes.
Key Takeaways
- Generate keys securely and limit who can request their use.
- HSMs protect key operations; TPMs bind protection to a device; KMS controls managed key access.
- Envelope encryption wraps a file’s DEK with a separately protected KEK.
- KEK rotation can rewrap DEKs without re-encrypting the files.
- Recoverable data needs recoverable decryption keys; escrow itself needs protection.
- Cryptographic erasure requires destroying every usable key copy.
6.2 Planning for post-quantum public-key cryptography
A cryptographically relevant quantum computer would be large and reliable enough to break widely used public-key algorithms. No such machine is publicly known to exist. Its possible arrival still matters for data that must remain secret for many years.
Identify which mathematics is threatened
Shor's algorithm would break the factoring and discrete-logarithm problems behind RSA, DH, ECDH, ECDSA and EdDSA. Enlarging an RSA key is not a post-quantum replacement.
Symmetric ciphers and hash functions face a different effect. Grover's algorithm offers a theoretical quadratic search speed-up, but quantum operations are costly and difficult to parallelize. AES-128 remains considered secure; AES-256 provides extra margin. SHA-384 and SHA-512 offer larger hash outputs. A quantum threat to RSA does not mean all encryption suddenly fails.
Account for data sent during migration
Harvest now, decrypt later means storing encrypted traffic today to attack its key establishment with a future quantum computer. Forward secrecy against theft of a long-term signing key does not stop that future mathematical attack on recorded classical exchange values.
Let x be the required secrecy lifetime, y the migration time and z the time until a relevant quantum computer. Mosca's planning rule flags risk when . If secrecy must last 15 years and migration takes five, vulnerable records sent near the end of migration need protection until roughly 20 years from now. Today's records require 15 years, not 20; the extra horizon comes from records still being sent during the transition.
Signature risk also matters for long-lived firmware and root keys. Forgery requires the quantum capability when a forgery is made, so its timing differs from storing ciphertext now for later decryption.
Know the standards and their jobs
| Standard | Algorithm | Job |
|---|---|---|
| FIPS 203 | ML-KEM | Establish a shared secret through encapsulation. |
| FIPS 204 | ML-DSA | Create digital signatures. |
| FIPS 205 | SLH-DSA | Create stateless hash-based signatures. |
These first standards were published in August 2024. ML-KEM derives from Kyber, ML-DSA from Dilithium and SLH-DSA from SPHINCS+. Falcon-derived FN-DSA is being standardized; HQC was selected in March 2025 as an additional KEM using different mathematics.
Post-quantum algorithms run on ordinary computers. They differ from quantum key distribution, which needs special hardware and quantum links. Their larger messages affect deployment: ML-KEM-768 has a 1,184-byte public key and a 1,088-byte encapsulation ciphertext; each X25519 public value is 32 bytes. An ML-DSA-65 signature is 3,309 bytes, compared with 64 for Ed25519.
Migrate systems in a workable order
Inventory algorithms, libraries, certificates, HSMs and vendor products. Prioritize long-lived sensitive data and systems that will remain deployed for years. Ask vendors about support and test interoperability and performance.
A hybrid post-quantum exchange, such as X25519MLKEM768, combines classical and post-quantum contributions so that a sound combiner retains protection if either component remains secure. It is already deployed in major browsers and services; certificates and signature migration are less mature. Build crypto agility so algorithms can be changed without redesigning the application. NIST's draft transition plan proposes removing quantum-vulnerable public-key algorithms by 2035, with earlier steps for weaker and higher-risk uses; it is a transition proposal, not a predicted quantum-computer arrival date.
Key Takeaways
- Shor’s algorithm threatens RSA and elliptic-curve public-key systems; symmetric encryption is affected differently.
- Long-lived secrets face harvest-now, decrypt-later risk before a capable quantum computer exists.
- Mosca’s rule compares secrecy lifetime plus migration time with the quantum threat horizon.
- ML-KEM establishes keys; ML-DSA and SLH-DSA create signatures.
- Inventory, prioritization, vendor testing and crypto agility support migration.
- Post-quantum cryptography runs on ordinary computers; QKD needs special physical equipment.
- Hybrid post-quantum exchange and hybrid bulk encryption describe different combinations.
Cryptography and PKI examples
1Choose protection for a research report
13 steps
- 1IntroductionFollow a report through three places
A research report begins as a readable file, crosses a network and becomes part of a database. Each place exposes it to a different observer.
Encryption can hide the report’s content, but the cipher, its key and the point where decryption happens all matter. Follow the report to decide whether protection belongs on a device, in the application or on the connection.
- 2ExplanationName the input, output and control
The report is plaintext before encryption. A cipher applies a secret key and produces ciphertext. Decryption with the right key restores the readable report.
The cipher can be published and examined. Security should depend on protecting the key, not hiding the design. Base64 would only rewrite the report into another reversible representation; anyone could decode it without a secret.
- 3ExampleChoose the security goal
The research team wants outsiders to be unable to read the report and reviewers to detect unauthorized changes. These are confidentiality and integrity, two different goals.
Encryption supplies confidentiality. A trusted digest can support comparison, and a MAC or signature can authenticate the data. A plain hash supplied by the same unknown sender does not identify that sender.
- 4ChallengeWould hiding the cipher solve key theft?
The team uses an examined cipher, but its secret key is exposed in a shared configuration file. Would hiding the cipher’s instructions repair that exposure?
---reveal---
No. Someone with the key can use the standard decryption process. Replace and protect the exposed key, and address how it leaked. The algorithm’s public design is compatible with security; the key’s uncontrolled disclosure is not.
- 5ExplanationUse one shared key for bulk data
A symmetric cipher uses one secret key for encryption and decryption. It efficiently protects a large report. AES processes 16-byte blocks, whether its key is 128, 192 or 256 bits; ChaCha20 produces a keystream with a 256-bit key.
The recipients must receive the shared key securely. Every person holding it gains the ability to read the report, so key access is part of the protection plan.
- 6Key InsightRequire a tag as well as ciphertext
Choose AEAD, such as AES-GCM or ChaCha20-Poly1305, so the receiver can reject altered data. The authentication tag is checked during decryption.
ECB exposes repeated patterns, and CBC alone does not authenticate the ciphertext. Changing from one AES key length to another does not add the authentication that a design is missing.
- 7ExampleAccount for the protected message
Suppose a report fragment contains 80 bytes. With AES-GCM, a 12-byte nonce and a 16-byte tag, its protected representation contains:
- 80 ciphertext bytes.
- 12 nonce bytes.
- 16 tag bytes.
The total is 108 bytes. The nonce travels openly with the ciphertext. Its job requires uniqueness with this key, not secrecy.
- 8ChallengeCan the next fragment reuse the nonce?
A sender encrypts a different 80-byte fragment with the same AES-GCM key. It plans to reuse the previous nonce because the plaintext changed. Is that safe?
---reveal---
No. A different plaintext does not permit nonce reuse under the same key. Reuse can expose message relationships and undermine authentication. The sender needs a nonce scheme that stays unique throughout that key’s use.
- 9ExplanationPlace storage encryption at the boundary
Full-disk encryption protects a locked, powered-off laptop containing the report. Once the laptop is unlocked, the operating system reads the report for the user.
TDE protects database files on disk, but accepted queries return plaintext. Application-side field encryption can exclude a query user only when that user lacks the keys and permission to decrypt the selected values.
- 10ExampleFollow the network leg
The author uploads the report over TLS. A network observer cannot read its protected contents, but the service terminates TLS and receives readable data. TDE then encrypts the stored database files.
If the provider must be unable to read content, those two layers do not establish that boundary. User-device encryption with keys unavailable to the provider changes where plaintext appears.
- 11ChallengeIdentify the remaining read path
A report is stored in a TDE-protected database. An administrator has ordinary permission to query its table. Can the administrator read the report, and which stronger field boundary would exclude that access?
---reveal---
The accepted query returns plaintext. Encrypt the selected content in the application and keep its keys and decryption access outside that administrator’s control. TDE alone protects copied files, not this query path.
- 12ConnectionDo not confuse display controls with secrecy
A screen may mask a value as "•••• 7164"; that limits what the screen reveals. Tokenization can substitute a token backed by a protected vault. Steganography can hide a message inside an image.
These techniques solve different problems. A masked screen may still use a plaintext database value, and finding a hidden message can reveal its content unless that content was also encrypted.
- 13RecapMatch mechanism and boundary
For a protected report, identify the required goal and the place where an attacker could read or change it. Use a current cipher with authentication, protect its key and follow its nonce rules.
Then trace where decryption occurs: an unlocked device, a database query or a TLS endpoint can expose readable data. Layers help when each addresses a distinct exposure.
2Deliver one encrypted file to several recipients
11 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMake a file both private and attributable
- 2ExplanationAssign the public and private roles
- 3ExamplePrepare the signed content
- 4ChallengeCheck the proposed key choice
- 5ExampleEncrypt the large file once
- 6ExampleAdd four ways to recover the key
- 7AnalogyAgree on a secret through public messages
- 8Key InsightAuthenticate the public exchange
- 9ChallengeCombine confidentiality and verification
- 10ConnectionSeparate two meanings of hybrid
- 11RecapKeep each key’s task distinct
3Check an update and protect account passwords
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionReadable information can still be checked
- 2ExplanationStart with the exact bytes
- 3ExampleCompare with an authentic reference
- 4ChallengeWhich check survives page replacement?
- 5ExplanationStore a verifier instead of the password
- 6ExampleMake equal passwords look different
- 7ExplanationCharge a cost for every guess
- 8ChallengeWhy are unique salts insufficient here?
- 9ExplanationAdd a signing key to the update
- 10ExampleFollow successful verification to its limit
- 11ChallengeWould HMAC give independent attribution?
- 12ConnectionCheck the evidence before the conclusion
- 13RecapKeep the three jobs separate
4Issue a certificate and recover from a key leak
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionMake a public key usable for a service
- 2ExplanationRead names and permissions separately
- 3ExamplePlan the names the service will answer
- 4ChallengeCan organization checks repair name coverage?
- 5ExampleCreate the request without exporting the secret
- 6ExplanationInstall the leaf and its intermediates
- 7ChallengeWhy do two clients disagree?
- 8ConnectionAutomate and observe issuance
- 9ExampleRespond when the private key leaks
- 10ExplanationPublish and obtain revocation information
- 11ExampleRead the rule from the issuance window
- 12ChallengeDid renewal remove the attacker’s credential?
- 13RecapKeep trust and operation connected
5Follow a TLS connection and diagnose its failure
12 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionConnect the pieces in one handshake
- 2ExampleStart with ClientHello
- 3ExampleDerive handshake keys after ServerHello
- 4ExplanationAuthenticate this specific exchange
- 5ChallengeAssess the effect of a later key theft
- 6TipRead the suite without adding missing choices
- 7ExampleFind the failed name check
- 8ChallengeRepair the redirect’s starting point
- 9Key InsightSeparate secure transport from honest content
- 10ConnectionKnow when a browser already requires HTTPS
- 11ChallengeIntegrate authentication and early data
- 12RecapUse the sequence to locate the failure
6Rotate stored-data keys and plan the quantum transition
13 steps
Save this lesson to follow every Walkthrough step by step.
- 1IntroductionManage both today’s keys and tomorrow’s algorithms
- 2ExplanationPut keys behind controlled operations
- 3ExampleEncrypt a file and wrap its key
- 4ExampleRotate the wrapping layer
- 5ChallengeCan disabling the KEK revoke cached plaintext?
- 6TipKeep recovery and erasure consistent
- 7ExplanationLocate the quantum-vulnerable layer
- 8ExampleAdd the required secrecy and transition times
- 9Key InsightExplain why recording starts early
- 10ExplanationChoose replacements by function
- 11ChallengeSet the migration priority
- 12ConnectionTurn the inventory into an upgrade path
- 13RecapCheck the whole recovery and migration path
Cryptography and PKI practice questions
Set 1: Apply keys, certificates and storage controls10 Practice Questions
Question 1 of 10
*.example.net. What hostname does it cover?Show answerHide answer
Question 2 of 10
Show answerHide answer
Question 3 of 10
Show answerHide answer
Question 4 of 10
Show answerHide answer
Question 5 of 10
Show answerHide answer
Question 6 of 10
Show answerHide answer
Question 7 of 10
portal.example.com in SAN but permits only client authentication in EKU. Why should a client reject it as a server credential?Show answerHide answer
Question 8 of 10
Show answerHide answer
Question 9 of 10
https://example.net get a name warning, while https://www.example.net works. SAN lists only the www name, and the bare address already sends a redirect after TLS. What fixes the whole path?Show answerHide answer
Question 10 of 10
Show answerHide answer
Set 2: Choose the right cryptographic protection10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
TLS_AES_256_GCM_SHA384 identify?Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 3: Diagnose failures across a protected system10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
api.example.org. Which key material should be sent to the CA?Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 4: Evaluate design and operating choices10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Set 5: Resolve connected cryptographic problems10 Practice Questions
Save this lesson to see every answer and practice every set.
Question 1 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 2 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 3 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 4 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 5 of 10
.pfx and says it needs no access controls because certificates are public. What risk should be checked?Show answerHide answer
Save this lesson to see this answer.
Question 6 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 7 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 8 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 9 of 10
Show answerHide answer
Save this lesson to see this answer.
Question 10 of 10
Show answerHide answer
Save this lesson to see this answer.
Stuck on your own question? Homework Help
Key Terms
A
ACME
AEAD
AES
Argon2id
Authentication tag
Avalanche effect
B
Birthday attack
Block cipher
Blockchain
Brute-force attack
C
CAA record
CBC
Certificate authority
Certificate fingerprint
Certificate lifecycle
Certificate pinning
Certificate revocation
Certificate revocation list
Certificate signing request
Certificate Transparency
CertificateVerify
ChaCha20
Cipher
Cipher suite
Ciphertext
Collision resistance
Crypto agility
Cryptographic erasure
Cryptography
Cryptoperiod
D
Data at rest
Data encryption key
Data in transit
Data in use
Data masking
Diffie–Hellman
Digest
Digital certificate
Digital signature
Downgrade attack
E
ECB
Ed25519
Elliptic-curve cryptography
Encoding
End-to-end encryption
Ephemeral key
Extended Key Usage
F
Field-level encryption
Finished
Forward secrecy
Full-disk encryption
G
GCM
H
Handshake transcript
Hardware security module
Harvest now, decrypt later
Hash function
HMAC
HSTS
Hybrid encryption
I
Intermediate CA
K
Key
Key derivation function
Key encapsulation mechanism
Key encryption key
Key escrow
Key management service
Key stretching
M
Message authentication code
ML-DSA
ML-KEM
Mode of operation
Mutual TLS
N
Non-repudiation
Nonce
O
OCSP
OCSP stapling
P
Password hashing
PBKDF2
Pepper
PKCS#12
.p12 or .pfx.Plaintext
Post-quantum cryptography
Preimage resistance
Private key
Public key
Public key infrastructure
Q
Quantum key distribution
R
Rainbow table
RSA
S
Salt
Second-preimage resistance
Secure enclave
Security strength
Self-signed certificate
SHA-256
SLH-DSA
Steganography
Stream cipher
Subject Alternative Name
Symmetric encryption
T
TLS
TLS inspection
Tokenization
Transparent data encryption
Trust store
Trusted Platform Module
W
Wildcard certificate
#
0-RTT early data
About this lesson
Make your own Study Materials
Turn your notes, slides and documents into Study Guides, Practice Questions, Flashcards and 6 more tools.