You are previewing Applied Cryptography: Protocols, Algorithms, and Source Code in C, Second Edition.
O'Reilly logo
Applied Cryptography: Protocols, Algorithms, and Source Code in C, Second Edition

Book Description

". . .the best introduction to cryptography I've ever seen. . . . The book the National Security Agency wanted never to be published. . . ." -Wired Magazine

". . .monumental . . . fascinating . . . comprehensive . . . the definitive work on cryptography for computer programmers . . ." -Dr. Dobb's Journal

". . .easily ranks as one of the most authoritative in its field." -PC Magazine

". . .the bible of code hackers." -The Millennium Whole Earth Catalog

This new edition of the cryptography classic provides you with a comprehensive survey of modern cryptography. The book details how programmers and electronic communications professionals can use cryptography-the technique of enciphering and deciphering messages-to maintain the privacy of computer data. It describes dozens of cryptography algorithms, gives practical advice on how to implement them into cryptographic software, and shows how they can be used to solve security problems. Covering the latest developments in practical cryptographic techniques, this new edition shows programmers who design computer applications, networks, and storage systems how they can build security into their software and systems.

What's new in the Second Edition?

  • New information on the Clipper Chip, including ways to defeat the key escrow mechanism

  • New encryption algorithms, including algorithms from the former Soviet Union and South Africa, and the RC4 stream cipher

  • The latest protocols for digital signatures, authentication, secure elections, digital cash, and more

  • More detailed information on key management and cryptographic implementations

Table of Contents

  1. Cover Page
  2. Title Page
  3. Copyright
  4. Contents in Brief
  5. Contents
  6. Foreword
  7. Preface
    1. How to Read This Book
    2. Acknowledgments
  8. About the Author
  9. CHAPTER 1: Foundations
    1. 1.1 TERMINOLOGY
    2. 1.2 STEGANOGRAPHY
    3. 1.3 SUBSTITUTION CIPHERS AND TRANSPOSITION CIPHERS
    4. 1.4 SIMPLE XOR
    5. 1.5 ONE-TIME PADS
    6. 1.6 COMPUTER ALGORITHMS
    7. 1.7 LARGE NUMBERS
  10. PART I: CRYPTOGRAPHIC PROTOCOLS
    1. CHAPTER 2: Protocol Building Blocks
      1. 2.1 INTRODUCTION TO PROTOCOLS
      2. 2.2 COMMUNICATIONS USING SYMMETRIC CRYPTOGRAPHY
      3. 2.3 ONE-WAY FUNCTIONS
      4. 2.4 ONE-WAY HASH FUNCTIONS
      5. 2.5 COMMUNICATIONS USING PUBLIC-KEY CRYPTOGRAPHY
      6. 2.6 DIGITAL SIGNATURES
      7. 2.7 DIGITAL SIGNATURES WITH ENCRYPTION
      8. 2.8 RANDOM AND PSEUDO-RANDOM-SEQUENCE GENERATION
    2. CHAPTER 3: Basic Protocols
      1. 3.1 KEY EXCHANGE
      2. 3.2 AUTHENTICATION
      3. 3.3 AUTHENTICATION AND KEY EXCHANGE
      4. 3.4 FORMAL ANALYSIS OF AUTHENTICATION AND KEY-EXCHANGE PROTOCOLS
      5. 3.5 MULTIPLE-KEY PUBLIC-KEY CRYPTOGRAPHY
      6. 3.6 SECRET SPLITTING
      7. 3.7 SECRET SHARING
      8. 3.8 CRYPTOGRAPHIC PROTECTION OF DATABASES
    3. CHAPTER 4: Intermediate Protocols
      1. 4.1 TIMESTAMPING SERVICES
      2. 4.2 SUBUMINAL CHANNEL
      3. 4.3 UNDENIABLE DIGITAL SIGNATURES
      4. 4.4 DESIGNATED CONFIRMER SIGNATURES
      5. 4.5 PROXY SIGNATURES
      6. 4.6 GROUP SIGNATURES
      7. 4.7 FAIL-STOP DIGITAL SIGNATURES
      8. 4.8 COMPUTING WITH ENCRYPTED DATA
      9. 4.9 BIT COMMITMENT
      10. 4.10 FAIR COIN FLIPS
      11. 4.11 MENTAL POKER
      12. 4.12 ONE-WAY ACCUMULATORS
      13. 4.13 ALL-OR-NOTHING DISCLOSURE OF SECRETS
      14. 4.14 KEY ESCROW
    4. CHAPTER 5: Advanced Protocols
      1. 5.1 ZERO-KNOWLEDGE PROOFS
      2. 5.2 ZERO-KNOWLEDGE PROOFS OF IDENTITY
      3. 5.3 BLIND SIGNATURES
      4. 5.4 IDENTITY-BASED PUBLIC-KEY CRYPTOGRAPHY
      5. 5.5 OBLIVIOUS TRANSFER
      6. 5.6 OBLIVIOUS SIGNATURES
      7. 5.7 SIMULTANEOUS CONTRACT SIGNING
      8. 5.8 DIGITAL CERTIFIED MAIL
      9. 5.9 SIMULTANEOUS EXCHANGE OF SECRETS
    5. CHAPTER 6: Esoteric Protocols
      1. 6.1 SECURE ELECTIONS
      2. 6.2 SECURE MULTIPARTY COMPUTATION
      3. 6.3 ANONYMOUS MESSAGE BROADCAST
      4. 6.4 DIGITAL CASH
  11. PART II: CRYPTOGRAPHIC TECHNIQUES
    1. CHAPTER 7: Key Length
      1. 7.1 SYMMETRIC KEY LENGTH
      2. 7.2 PUBLIC-KEY KEY LENGTH
      3. 7.3 COMPARING SYMMETRIC AND PUBLIC-KEY KEY LENGTH
      4. 7.4 BIRTHDAY ATTACKS AGAINST ONE-WAY HASH FUNCTIONS
      5. 7.5 HOW LONG SHOULD A KEY BE?
      6. 7.6 CAVEAT EMPTOR
    2. CHAPTER 8: Key Management
      1. 8.1 GENERATING KEYS
      2. 8.2 NONLINEAR KEYSPACES
      3. 8.3 TRANSFERRING KEYS
      4. 8.4 VERIFYING KEYS
      5. 8.5 USING KEYS
      6. 8.6 UPDATING KEYS
      7. 8.7 STORING KEYS
      8. 8.8 BACKUP KEYS
      9. 8.9 COMPROMISED KEYS
      10. 8.10 LIFETIME OF KEYS
      11. 8.11 DESTROYING KEYS
      12. 8.12 PUBLIC-KEY KEY MANAGEMENT
    3. CHAPTER 9: Algorithm Types and Modes
      1. 9.1 ELECTRONIC CODEBOOK MODE
      2. 9.2 BLOCK REPLAY
      3. 9.3 CIPHER BLOCK CHAINING MODE
      4. 9.4 STREAM CIPHERS
      5. 9.5 SELF-SYNCHRONIZING STREAM CIPHERS
      6. 9.6 CIPHER-FEEDBACK MODE
      7. 9.7 SYNCHRONOUS STREAM CIPHERS
      8. 9.8 OUTPUT-FEEDBACK MODE
      9. 9.9 COUNTER MODE
      10. 9.10 OTHER BLOCK-CIPHER MODES
      11. 9.11 CHOOSING A CIPHER MODE
      12. 9.12 INTERLEAVING
      13. 9.13 BLOCK CIPHERS VERSUS STREAM CIPHERS
    4. CHAPTER 10: Using Algorithms
      1. 10.1 CHOOSING AN ALGORITHM
      2. 10.2 PUBLIC-KEY CRYPTOGRAPHY VERSUS SYMMETRIC CRYPTOGRAPHY
      3. 10.3 ENCRYPTING COMMUNICATIONS CHANNELS
      4. 10.4 ENCRYPTING DATA FOR STORAGE
      5. 10.5 HARDWARE ENCRYPTION VERSUS SOFTWARE ENCRYPTION
      6. 10.6 COMPRESSION, ENCODING, AND ENCRYPTION
      7. 10.7 DETECTING ENCRYPTION
      8. 10.8 HIDING CIPHERTEXT IN CIPHERTEXT
      9. 10.9 DESTROYING INFORMATION
  12. PART III: CRYPTOGRAPHIC ALGORITHMS
    1. CHAPTER 11: Mathematical Background
      1. 11.1 INFORMATION THEORY
      2. 11.2 COMPLEXITY THEORY
      3. 11.3 NUMBER THEORY
      4. 11.4 FACTORING
      5. 11.5 PRIME NUMBER GENERATION
      6. 11.6 DISCRETE LOGARITHMS IN A FINITE FIELD
    2. CHAPTER 12: Data Encryption Standard (DES)
      1. 12.1 BACKGROUND
      2. 12.2 DESCRIPTION OF DES
      3. 12.3 SECURITY OF DES
      4. 12.4 DIFFERENTIAL AND LINEAR CRYPTANALYSIS
      5. 12.5 THE REAL DESIGN CRITERIA
      6. 12.6 DES VARIANTS
      7. 12.7 HOW SECURE IS DES TODAY?
    3. CHAPTER 13: Other Block Ciphers
      1. 13.1 LUCIFER
      2. 13.2 MADRYGA
      3. 13.3 NEWDES
      4. 13.4 FEAL
      5. 13.5 REDOC
      6. 13.6 LOKI
      7. 13.7 KHUFU AND KHAFRE
      8. 13.8 RC2
      9. 13.9 IDEA
      10. 13.10 MMB
      11. 13.11 CA-1.1
      12. 13.12 SKIPJACK
    4. CHAPTER 14: Still Other Block Ciphers
      1. 14.1 GOST
      2. 14.2 CAST
      3. 14.3 BLOWFISH
      4. 14.4 SAFER
      5. 14.5 3-WAY
      6. 14.6 CRAB
      7. 14.7 SXAL8/MBAL
      8. 14.8 RC5
      9. 14.9 OTHER BLOCK ALGORITHMS
      10. 14.10 THEORY OF BLOCK CIPHER DESIGN
      11. 14.11 USING ONE-WAY HASH FUNCTIONS
      12. 14.12 CHOOSING A BLOCK ALGORITHM
    5. CHAPTER 15: Combining Block Ciphers
      1. 15.1 DOUBLE ENCRYPTION
      2. 15.2 TRIPLE ENCRYPTION
      3. 15.3 DOUBLING THE BLOCK LENGTH
      4. 15.4 OTHER MULTIPLE ENCRYPTION SCHEMES
      5. 15.5 CDMF KEY SHORTENING
      6. 15.6 WHITENING
      7. 15.7 CASCADING MULTIPLE BLOCK ALGORITHMS
      8. 15.8 COMBINING MULTIPLE BLOCK ALGORITHMS
    6. CHAPTER 16: Pseudo-Random-Sequence Generators and Stream Ciphers
      1. 16.1 LINEAR CONGRUENTIAL GENERATORS
      2. 16.2 LINEAR FEEDBACK SHIFT REGISTERS
      3. 16.3 DESIGN AND ANALYSIS OF STREAM CIPHERS
      4. 16.4 STREAM CIPHERS USING LFSRS
      5. 16.5 A5
      6. 16.6 HUGHES XPD/KPD
      7. 16.7 NANOTEQ
      8. 16.8 RAMBUTAN
      9. 16.9 ADDITIVE GENERATORS
      10. 16.10 GIFFORD
      11. 16.11 ALGORITHM M
      12. 16.12 PKZIP
    7. CHAPTER 17: Other Stream Ciphers and Real Random-Sequence Generators
      1. 17.1 RC4
      2. 17.2 SEAL
      3. 17.3 WAKE
      4. 17.4 FEEDBACK WITH CARRY SHIFT REGISTERS
      5. 17.5 STREAM CIPHERS USING FCSRS
      6. 17.6 NONLINEAR-FEEDBACK SHIFT REGISTERS
      7. 17.7 OTHER STREAM CIPHERS
      8. 17.8 SYSTEM-THEORETIC APPROACH TO STREAM-CIPHER DESIGN
      9. 17.9 COMPLEXITY-THEORETIC APPROACH TO STREAM-CIPHER DESIGN
      10. 17.10 OTHER APPROACHES TO STREAM-CIPHER DESIGN
      11. 17.11 CASCADING MULTIPLE STREAM CIPHERS
      12. 17.12 CHOOSING A STREAM CIPHER
      13. 17.13 GENERATING MULTIPLE STREAMS FROM A SINGLE PSEUDO-RANDOM-SEQUENCE GENERATOR
      14. 17.14 REAL RANDOM-SEQUENCE GENERATORS
    8. CHAPTER 18: One-Way Hash Functions
      1. 18.1 BACKGROUND
      2. 18.2 SNEFRU
      3. 18.3 N-HASH
      4. 18.4 MD4
      5. 18.5 MD5
      6. 18.6 MD2
      7. 18.7 SECURE HASH ALGORITHM (SHA)
      8. 18.8 RIPE-MD
      9. 18.9 HAVAL
      10. 18.10 OTHER ONE-WAY HASH FUNCTIONS
      11. 18.11 ONE-WAY HASH FUNCTIONS USING SYMMETRIC BLOCK ALGORITHMS
      12. 18.12 USING PUBLIC-KEY ALGORITHMS
      13. 18.13 CHOOSING A ONE-WAY HASH FUNCTION
      14. 18.14 MESSAGE AUTHENTICATION CODES
    9. CHAPTER 19: Public-Key Algorithms
      1. 19.1 BACKGROUND
      2. 19.2 KNAPSACK ALGORITHMS
      3. 19.3 RSA
      4. 19.4 POHLIG-HELLMAN
      5. 19.5 RABIN
      6. 19.6 ELGAMAL
      7. 19.7 MCELIECE
      8. 19.8 ELLIPTIC CURVE CRYPTOSYSTEMS
      9. 19.9 LUC
      10. 19.10 FINITE AUTOMATON PUBLIC-KEY CRYPTOSYSTEMS
    10. CHAPTER 20: Public-Key Digital Signature Algorithms
      1. 20.1 DIGITAL SIGNATURE ALGORITHM (DSA)
      2. 20.2 DSA Variants
      3. 20.3 GOST DIGITAL SIGNATURE ALGORITHM
      4. 20.4 DISCRETE LOGARITHM SIGNATURE SCHEMES
      5. 20.5 ONG-SCHNORR-SHAMIR
      6. 20.6 ESIGN
      7. 20.7 CELLULAR AUTOMATA
      8. 20.8 OTHER PUBLIC-KEY ALGORITHMS
    11. CHAPTER 21: Identification Schemes
      1. 21.1 FEIGE-FIAT-SHAMIR
      2. 21.2 GUILLOU-QUISQUATER
      3. 21.3 SCHNORR
      4. 21.4 CONVERTING IDENTIFICATION SCHEMES TO SIGNATURE SCHEMES
    12. CHAPTER 22: Key-Exchange Algorithms
      1. 22.1 DIFFIE-HELLMAN
      2. 22.2 STATION-TO-STATION PROTOCOL
      3. 22.3 SHAMIR'S THREE-PASS PROTOCOL
      4. 22.4 COMSET
      5. 22.5 ENCRYPTED KEY EXCHANGE
      6. 22.6 FORTIFIED KEY NEGOTIATION
      7. 22.7 CONFERENCE KEY DISTRIBUTION AND SECRET BROADCASTING
    13. CHAPTER 23: Special Algorithms for Protocols
      1. 23.1 MULTIPLE-KEY PUBLIC-KEY CRYPTOGRAPHY
      2. 23.2 SECRET-SHARING ALGORITHMS
      3. 23.3 SUBLIMINAL CHANNEL
      4. 23.4 UNDENIABLE DIGITAL SIGNATURES
      5. 23.5 DESIGNATED CONFIRMER SIGNATURES
      6. 23.6 COMPUTING WITH ENCRYPTED DATA
      7. 23.7 FAIR COIN FLIPS
      8. 23.8 ONE-WAY ACCUMULATORS
      9. 23.9 ALL-OR-NOTHING DISCLOSURE OF SECRETS
      10. 23.10 FAIR AND FAILSAFE CRYPTOSYSTEMS
      11. 23.11 ZERO-KNOWLEDGE PROOFS OF KNOWLEDGE
      12. 23.12 BLIND SIGNATURES
      13. 23.13 OBLIVIOUS TRANSFER
      14. 23.14 SECURE MULTIPARTY COMPUTATION
      15. 23.15 PROBABILISTIC ENCRYPTION
      16. 23.16 QUANTUM CRYPTOGRAPHY
  13. PART IV: THE REAL WORLD
    1. CHAPTER 24: Example Implementations
      1. 24.1 IBM SECRET-KEY MANAGEMENT PROTOCOL
      2. 24.2 MITRENET
      3. 24.3 ISDN
      4. 24.4 STU-III
      5. 24.5 KERBEROS
      6. 24.6 KRYPTOKNIGHT
      7. 24.7 SESAME
      8. 24.8 IBM COMMON CRYPTOGRAPHIC ARCHITECTURE
      9. 24.9 ISO AUTHENTICATION FRAMEWORK
      10. 24.10 PRIVACY-ENHANCED MAIL (PEM)
      11. 24.11 MESSAGE SECURITY PROTOCOL (MSP)
      12. 24.12 PRETTY GOOD PRIVACY (PGP)
      13. 24.13 SMART CARDS
      14. 24.14 PUBLIC-KEY CRYPTOGRAPHY STANDARDS (PKCS)
      15. 24.15 UNIVERSAL ELECTRONIC PAYMENT SYSTEM (UEPS)
      16. 24.16 CLIPPER
      17. 24.17 CAPSTONE
      18. 24.18 AT&T MODEL 3600 TELEPHONE SECURITY DEVICE (TSD)
    2. CHAPTER 25: Politics
      1. 25.1 NATIONAL SECURITY AGENCY (NSA)
      2. 25.2 NATIONAL COMPUTER SECURITY CENTER (NCSC)
      3. 25.3 NATIONAL INSTITUTE OF STANDARDS AND TECHNOLOGY (NIST)
      4. 25.4 RSA DATA SECURITY, INC.
      5. 25.5 PUBLIC KEY PARTNERS
      6. 25.6 INTERNATIONAL ASSOCIATION FOR CRYPTOLOGIC RESEARCH (IACR)
      7. 25.7 RACE INTEGRITY PRIMITIVES EVALUATION (RIPE)
      8. 25.8 CONDITIONAL ACCESS FOR EUROPE (CAFE)
      9. 25.9 ISO/IEC 9979
      10. 25.10 PROFESSIONAL, CIVIL LIBERTIES, AND INDUSTRY GROUPS
      11. 25.11 SCI.CRYPT
      12. 25.12 CYPHERPUNKS
      13. 25.13 PATENTS
      14. 25.14 U.S. EXPORT RULES
      15. 25.15 FOREIGN IMPORT AND EXPORT OF CRYPTOGRAPHY
      16. 25.16 LEGAL ISSUES
    3. Afterword by Matt Blaze
  14. PART V: SOURCE CODE
    1. DES
    2. LOKI91
    3. IDEA
    4. GOST
    5. BLOWFISH
    6. 3-Way
    7. RC5
    8. A5
    9. SEAL
  15. References
  16. Index