Summary of Fundamentals of Cryptography

Fundamentals of Cryptography: A Student's Guide

Introduction

Cryptography is the science of protecting information by transforming it into secure formats so that only authorized parties can read or use it. This material covers core concepts of cryptographic building blocks, block-cipher modes of operation, public-key systems (RSA), hybrid encryption, digital signatures, and practical considerations for keys and algorithms.

Definition: Cryptography is the set of techniques for ensuring confidentiality, integrity, authentication, and non-repudiation of information.

Core goals of cryptography

  • Confidentiality: Keep information accessible only to authorized parties.
  • Integrity: Ensure data has not been altered by unauthorized parties.
  • Authentication: Verify the identity or origin of data or an entity.
  • Non-repudiation: Provide evidence that a specific entity originated data.

Definition: Confidentiality is the property of non-public information remaining accessible only to authorized parties.

Block ciphers and modes of operation

Block ciphers encrypt fixed-size blocks of data using a symmetric key. Modes of operation define how to apply block ciphers to messages longer than one block.

ECB (Electronic Codebook)

  • Each plaintext block is encrypted independently.
  • Pros: Simple, random access to blocks.
  • Cons: Repeated plaintext blocks produce repeated ciphertext blocks; patterns leak information.

Definition: ECB mode encrypts each block independently with the block cipher and key.

CBC (Cipher Block Chaining)

  • Each plaintext block is XORed with the previous ciphertext block before encryption.
  • Uses an Initialization Vector (IV) for the first block.
  • Pros: Hides repeated plaintext patterns better than ECB.
  • Cons: Sequential processing (no straightforward parallel encryption); requires proper IV handling and padding for the final short block.

Definition: CBC mode chains blocks so each ciphertext block depends on all previous plaintext blocks and an IV.

CTR (Counter) mode

  • Turns a block cipher into a stream cipher by encrypting counters and XORing with plaintext.
  • Pros: Parallel en-/decryption, random access, precomputation possible, no error propagation.
  • Cons: Catastrophic if a key/counter pair is reused — must ensure unique counters per key.

Definition: CTR mode generates a keystream by encrypting sequential counter values; keystream is XORed with plaintext.

Other modern modes

  • OCB, OFB, GCM, XTS — each addresses specific use cases (authenticated encryption, disk encryption, etc.).
  • Many have tricky parameterization; follow standards and libraries.

Modes summary (table)

ModeParallelizableRandom accessError propagationMain risk
ECBYesYesIsolatedReveals plaintext patterns
CBCNo (enc), Yes (dec with tweaks)LimitedOne block error affects next blockIV misuse, padding issues
CTRYesYesIsolatedReuse of counter/key values
💡 Did you know?Fun fact: Many practical data leaks have resulted from using ECB inappropriately (e.g., encrypted images where structure is still visible).

Keys vs Algorithms

  • Kerckhoffs' principle: Security should rely on the secrecy of keys, not the secrecy of algorithms.
  • Algorithms should be public and scrutinized; keys must remain secret.
  • Hardcoding secrets in many devices is dangerous: if exposed, all devices must be replaced.

Definition: Kerckhoffs' principle states that a cryptosystem should remain secure even if everything about the system, except the key, is public knowledge.

Types of algorithms

  • With keys (keyed): Symmetric ciphers, asymmetric ciphers, MACs.
  • Without keys (unkeyed): Hash functions, RNGs.
💡 Did you know?Did you know that proprietary or closed-design ciphers are often broken after public analysis reveals weaknesses, so open review is crucial for trust?

Reminder: Don’t invent crypto

  • Proprietary, closed, hardware-only cipher
Sign up for the full summary
FlashcardsKnowledge testSummaryPodcastMindmap
Start for free

Already have an account? Sign in

Cryptography Essentials

Klíčová slova: Cryptography, Cryptographic Hashes, Message Authentication Codes, Cryptographic Attacks

Klíčové pojmy: Cryptography goals: confidentiality, integrity, authentication, non-repudiation, Kerckhoffs principle: secrecy must be in keys, not algorithms, ECB leaks patterns; avoid for structured data, CBC requires a unique IV and correct padding handling, CTR allows parallelism but never reuse key/counter pairs, Use hybrid encryption: asymmetric for keys, symmetric for bulk data, Digital signatures sign hashes; keep signing keys private, Do not use same key pair for signing and encryption, Prefer vetted algorithms and libraries over homegrown crypto, RSA relies on difficulty of factoring $n=p\cdot q$, Public keys must be authenticated; private keys must stay secret, Authenticated modes (e.g., GCM) provide confidentiality and integrity

## Introduction Cryptography is the science of protecting information by transforming it into secure formats so that only authorized parties can read or use it. This material covers core concepts of cryptographic building blocks, block-cipher modes of operation, public-key systems (RSA), hybrid encryption, digital signatures, and practical considerations for keys and algorithms. > **Definition:** Cryptography is the set of techniques for ensuring confidentiality, integrity, authentication, and non-repudiation of information. ## Core goals of cryptography - **Confidentiality:** Keep information accessible only to authorized parties. - **Integrity:** Ensure data has not been altered by unauthorized parties. - **Authentication:** Verify the identity or origin of data or an entity. - **Non-repudiation:** Provide evidence that a specific entity originated data. > **Definition:** Confidentiality is the property of non-public information remaining accessible only to authorized parties. ## Block ciphers and modes of operation Block ciphers encrypt fixed-size blocks of data using a symmetric key. Modes of operation define how to apply block ciphers to messages longer than one block. ### ECB (Electronic Codebook) - Each plaintext block is encrypted independently. - Pros: Simple, random access to blocks. - Cons: Repeated plaintext blocks produce repeated ciphertext blocks; patterns leak information. > **Definition:** ECB mode encrypts each block independently with the block cipher and key. ### CBC (Cipher Block Chaining) - Each plaintext block is XORed with the previous ciphertext block before encryption. - Uses an Initialization Vector (IV) for the first block. - Pros: Hides repeated plaintext patterns better than ECB. - Cons: Sequential processing (no straightforward parallel encryption); requires proper IV handling and padding for the final short block. > **Definition:** CBC mode chains blocks so each ciphertext block depends on all previous plaintext blocks and an IV. ### CTR (Counter) mode - Turns a block cipher into a stream cipher by encrypting counters and XORing with plaintext. - Pros: Parallel en-/decryption, random access, precomputation possible, no error propagation. - Cons: Catastrophic if a key/counter pair is reused — must ensure unique counters per key. > **Definition:** CTR mode generates a keystream by encrypting sequential counter values; keystream is XORed with plaintext. ### Other modern modes - OCB, OFB, GCM, XTS — each addresses specific use cases (authenticated encryption, disk encryption, etc.). - Many have tricky parameterization; follow standards and libraries. ### Modes summary (table) | Mode | Parallelizable | Random access | Error propagation | Main risk | |---|---:|---:|---:|---| | ECB | Yes | Yes | Isolated | Reveals plaintext patterns | | CBC | No (enc), Yes (dec with tweaks) | Limited | One block error affects next block | IV misuse, padding issues | | CTR | Yes | Yes | Isolated | Reuse of counter/key values | Fun fact: Many practical data leaks have resulted from using ECB inappropriately (e.g., encrypted images where structure is still visible). ## Keys vs Algorithms - **Kerckhoffs' principle:** Security should rely on the secrecy of keys, not the secrecy of algorithms. - Algorithms should be public and scrutinized; keys must remain secret. - Hardcoding secrets in many devices is dangerous: if exposed, all devices must be replaced. > **Definition:** Kerckhoffs' principle states that a cryptosystem should remain secure even if everything about the system, except the key, is public knowledge. ## Types of algorithms - **With keys (keyed):** Symmetric ciphers, asymmetric ciphers, MACs. - **Without keys (unkeyed):** Hash functions, RNGs. Did you know that proprietary or closed-design ciphers are often broken after public analysis reveals weaknesses, so open review is crucial for trust? ## Reminder: Don’t invent crypto - Proprietary, closed, hardware-only cipher