Hacking ebook cryptography engineering design principles and practical applications

385 219 0
Hacking ebook cryptography engineering design principles and practical applications

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

Thông tin tài liệu

Cryptography Engineering Cryptography Engineering Design Principles and Practical Applications Niels Ferguson Bruce Schneier Tadayoshi Kohno Wiley Publishing, Inc Cryptography Engineering: Design Principles and Practical Applications Published by Wiley Publishing, Inc 10475 Crosspoint Boulevard Indianapolis, IN 46256 www.wiley.com Copyright © 2010 by Niels Ferguson, Bruce Schneier, and Tadayoshi Kohno Published by Wiley Publishing, Inc., Indianapolis, Indiana Published simultaneously in Canada ISBN: 978-0-470-47424-2 Manufactured in the United States of America 10 No part of this publication may be reproduced, stored in a retrieval system or transmitted in any form or by any means, electronic, mechanical, photocopying, recording, scanning or otherwise, except as permitted under Sections 107 or 108 of the 1976 United States Copyright Act, without either the prior written permission of the Publisher, or authorization through payment of the appropriate per-copy fee to the Copyright Clearance Center, 222 Rosewood Drive, Danvers, MA 01923, (978) 750-8400, fax (978) 646-8600 Requests to the Publisher for permission should be addressed to the Permissions Department, John Wiley & Sons, Inc., 111 River Street, Hoboken, NJ 07030, (201) 748-6011, fax (201) 748-6008, or online at http://www.wiley.com/go/permissions Limit of Liability/Disclaimer of Warranty: The publisher and the author make no representations or warranties with respect to the accuracy or completeness of the contents of this work and specifically disclaim all warranties, including without limitation warranties of fitness for a particular purpose No warranty may be created or extended by sales or promotional materials The advice and strategies contained herein may not be suitable for every situation This work is sold with the understanding that the publisher is not engaged in rendering legal, accounting, or other professional services If professional assistance is required, the services of a competent professional person should be sought Neither the publisher nor the author shall be liable for damages arising herefrom The fact that an organization or Web site is referred to in this work as a citation and/or a potential source of further information does not mean that the author or the publisher endorses the information the organization or Web site may provide or recommendations it may make Further, readers should be aware that Internet Web sites listed in this work may have changed or disappeared between when this work was written and when it is read For general information on our other products and services please contact our Customer Care Department within the United States at (877) 762-2974, outside the United States at (317) 572-3993 or fax (317) 572-4002 Wiley also publishes its books in a variety of electronic formats Some content that appears in print may not be available in electronic books Library of Congress Control Number: 2010920648 Trademarks: Wiley and the Wiley logo are trademarks or registered trademarks of John Wiley & Sons, Inc and/or its affiliates, in the United States and other countries, and may not be used without written permission All other trademarks are the property of their respective owners Wiley Publishing, Inc is not associated with any product or vendor mentioned in this book To Denise, who has made me truly happy —Niels Ferguson To Karen; still, after all these years —Bruce Schneier To Taryn, for making everything possible —Tadayoshi Kohno Credits Executive Editor Carol Long Project Editor Tom Dinse Production Editor Daniel Scribner Editorial Director Robyn B Siesky Editorial Manager Mary Beth Wakefield Production Manager Tim Tate Vice President and Executive Group Publisher Richard Swadley vi Vice President and Executive Publisher Barry Pruett Associate Publisher Jim Minatel Project Coordinator, Cover Lynsey Stanford Proofreader Publication Services, Inc Indexer Robert Swanson Cover Image © DSGpro/istockphoto Cover Designer Michael E Trent About the Authors Niels Ferguson has spent his entire career working as a cryptographic engineer After studying mathematics in Eindhoven, he worked for DigiCash analyzing, designing, and implementing advanced electronic payment systems that protect the privacy of the user Later he worked as a cryptographic consultant for Counterpane and MacFergus, analyzing hundreds of systems and designing dozens He was part of the team that designed the Twofish block cipher, performed some of the best initial analysis of AES, and co-designed the encryption system currently used by WiFi Since 2004 he works at Microsoft where he helped design and implement the BitLocker disk encryption system He currently works in the Windows cryptography team that is responsible for the cryptographic implementations in Windows and other Microsoft products Bruce Schneier is an internationally renowned security technologist, referred to by The Economist as a ‘‘security guru.’’ He is the author of eight books—including the best sellers Beyond Fear: Thinking Sensibly about Security in an Uncertain World, Secrets and Lies, and Applied Cryptography—as well as hundreds of articles and essays in national and international publications, and many more academic papers His influential newsletter Crypto-Gram, and his blog Schneier on Security, are read by over 250,000 people He is a frequent guest on television and radio, and is regularly quoted in the press on issues surrounding security and privacy He has testified before Congress on multiple occasions, and has served on several government technical committees Schneier is the Chief Security Technology Officer of BT vii viii About the Authors Tadayoshi Kohno (Yoshi) is an assistant professor of computer science and engineering at the University of Washington His research focuses on improving the security and privacy properties of current and future technologies He conducted the initial security analysis of the Diebold AccuVote-TS electronic voting machine source code in 2003, and has since turned his attention to securing emerging technologies ranging from wireless implantable pacemakers and defibrillators to cloud computing He is the recipient of a National Science Foundation CAREER Award and an Alfred P Sloan Research Fellowship In 2007 he was awarded the MIT Technology Review TR-35 Award for his work in applied cryptography, recognizing him as one of the world’s top innovators under the age of 35 He received his PhD in computer science from the University of California at San Diego Niels, Bruce, and Yoshi are part of the team that designed the Skein hash function, one of the competitors in NIST’s SHA-3 competition Index A access control list (ACL), 285–286 accumulator events, 151 pools, 151 randomness, 147–155 ACL See access control list addition bitwise, 51 modular, 246 modulo, 168–169 without carry, 51 AddRandomEvent, 154–155 add-with-carry, CPU, 243 Adelman, Leonard, 195 administrators, 127 Advanced Encryption Standard (AES), 54–56, 78, 321–322 initialization, 132 128-bit, 54 randomness generator, 143 rounds, 54–55 RSA, 205 S-box, 54 testing, 244 adversarial setting, 7–8 failure rate, 244 AES See Advanced Encryption Standard algorithms, 24–25 binary, 179 distinguishers, 47–48 efficiency, 37 extended Euclidian algorithm, 171–172 Kerckhoff’s principle, 44 primes, 164 public keys, 28 secure channel, 107–112 wooping, 246 Anderson, Ross, 18 Applied Cryptography (Schneier), 18, 323 The Art of Computer Programming (Knuth), 140 ASN.1, 220 assertions, 130–131 asymmetric key, encryption, 28 ATM, PIN code, 288 atomicity, file system updates, 158 attack tree, 5–6 attacks, 31–33 See also specific attack types block ciphers, 44–45 entropy, 142 hash functions, 79 MAC, 90 plaintext, 69 339 340 Index ■ A–C attacks, (continued) quantum physics, 139 RF, 252 RSA, 205 steps, 36 authentication, 25–27 See also message authentication code clock, 264 conventions, 230–231 encryption, 63, 71, 102–104 GMAC, 94 key negotiation, 227–228 MAC, 96, 102–104, 106 message order, 26 messages, 229 protocols, 97 public key, 189 secret keys, 26 secure channel, 102–104, 106 session keys, 229 symmetric keys, 239 authorization, PKI, 285–286 B backups, VMs, 157–158 banks CA, 276 credit card organization, 277 Biham, Eli, 44 binary algorithm, 179 biometrics, 308–309 birthday attacks, 33–34 hash functions, 84 HMAC, 93 meet-in-the-middle attacks, 35 bitslice implementation, 56 bitwise addition, 51 blind signatures, 252 block cipher mode, 44, 63–76 ciphertext c, 64 padding, 64–65 block ciphers, 43–62 attacks, 44–45 chosen-plaintext attack, 44 ciphertext c, 43, 49–50 ciphertext-only attack, 44 generic attacks, 47 GMAC, 94 hash functions, 45 ideal, 46–50 interface, 45 Kerckhoff’s principle, 44 128-bit, 43 permutations, 44, 46 plaintext, 43, 49–50 rounds, 50–51 secret keys, 43 testing, 244 256-bit, 43 Boojum, 126 Bos, Jurjen, 245 bridges, 7, 14–15 buffer overflow, 131 C C++, 121–122 CA See certificate authority cache CPU, 124, 152, 251 secrets, 124 Carmichael numbers, 177 CBC See cipher block chaining CCM, 71, 112–113 CEN See European Committee for Standardization certificate(s), 30 credential systems, 286–288 multilevel, 277–278 PKI, 275, 277–278, 295–297 self-certifying, 296 SSL, 218 certificate authority (CA), 30 banks, 276 fast expiration, 290–291 liability, 30 PKI, 275–276, 283–285 RA, 279–280 Index root key, 293, 296–297 trust, 30 certificate chain, 277 certificate revocation list (CRL), 289–290 key servers, 292–293 Chaum, David, 245 checks See testing Chinese Remainder Theorem (CRT), 196–199 complexity, 198 exponentiations, 198 multiplication, 198 signatures, 239 chosen-ciphertext attack, 32 chosen-key attack, 45 chosen-plaintext attack, 32 block ciphers, 44 distinguishers, 48 cipher block chaining (CBC), 65–68 information leakage, 72, 74 MAC, 91–93 ciphertext c, 24 block cipher mode, 64 block ciphers, 43, 49–50 plaintext, 64 ciphertext-only attack, 31 block ciphers, 44 distinguishers, 48 clock, 259–268 authentication, 264 counters, 264 expiration time, 260 monotonicity, 260 PKI, 264 real-time clock chip, 261 real-time transactions, 260–261 security, 262–263 setting back, 262 setting forward, 263 stopping, 262–263 time, 266–267 time synchronization, 264 unique value, 260 ■ CMAC, 93 code quality, 128 The Codebreakers (Kahn), 18 collision(s), 34 chances of, 73–74 hash functions, 84 collision attacks, 33–35 DH, 190 stream cipher, 69 collision resistance, 78 complexity, 17 CRT, 198 protocols, 238–241 security, 129 test-and-fix, 37–38 composites, 164 constant-time operations, 252 conventions, authentication, 230–231 correct programs, 116–119 test-and-fix, 118 counter IV, 66 counter mode (CTR), 70–71 encryption, 106 GMAC, 94 information leakage, 73, 74 counters clock, 264 same-state problem, 266 CPU, 15–16 add-with-carry, 243 cache, 124, 152, 251 hash functions, 152 multiplication, 251 registers, 127 secrets, 122 credential systems delegation, 287–288 PKI, 286–288 credit card(s) digital signature, 11 PIN code, 11 SET, 10–11 viruses, 11 credit card organization, banks, 277 C 341 342 Index ■ C–E CRL See certificate revocation list CRT See Chinese Remainder Theorem Crypto-Gram, 18 CTR See counter mode current events, 19–20 CWC, 112–113 D Data Encryption Standard (DES), 51–54 exhaustive search attack, 53 56-bits, 51 rounds, 51–52 64-bit, 52 data integrity, 127–128 data-dependent rotation, 251 DataEncryption Standard (DES), 55 Davies-Meyer hash function, 45 debuggers, 127, 128 decryption, 24, 63 RSA, 207–208, 251 decryptRandomKeyWithRSA, 207–208 defense in depth, delegation, credential systems, 287–288 denial-of-service attack (DOS), 103 DES See Data Encryption Standard detection, security, 16 DH See Diffie-Hellman key exchange protocol dictionary attack offline, 241 passwords, 228 Diffie, Whitfield, 181 Diffie-Hellman key exchange protocol (DH), 181–193 collision attacks, 190 groups, 182–183 information leakage, 248 man-in-the-middle attack, 184–185 pitfalls, 185–186 public keys, 239 safe primes, 186–187 Station-to-Station protocol, 228 subgroups, 187–188, 191 testing, 248 digest, 77 digital rights management (DRM), 14 digital signature credit cards, 11 public key, 30 public keys, 29 RSA, 200 SET, 11 Dijkstra, Edsger, 118 direct authorization, 286 discrete logarithm (DL), 183 distinguishers algorithms, 47–48 chosen-plaintext attack, 48 ciphertext-only attack, 48 known-plaintext attack, 48 distinguishing attack, 32–33 divisibility, primes, 163–166 DL See discrete logarithm Document Template Definition (DTD), 221 DOS See denial-of-service attack DRAM See Dynamic RAM DRM See digital rights management DTD See Document Template Definition Dynamic RAM (DRAM), 125 E EC See error-correcting code memory ECB See electronic cookbook EEPROM, 313 efficiency, 15 algorithms, 37 public keys, 28 safe primes, 187 Einstein-Podolsky-Rosen paradox, 139 Electrical and Electronics Engineers (IEEE), 317 electronic banking, 276 Index electronic cookbook (ECB), 65 information leakage, 72 electronic payment systems, 260–261 encryption, 23–39 asymmetric key, 28 authentication, 63, 71, 102–104 CTR, 106 MAC, 102–104 public keys, 27–29, 189 RSA, 206–209, 248 secret keys, 24 secure channel, 102–104, 106–107 storage, 24 symmetric keys, 28 encryptRandomKeyWithRSA, 207 entropy, 137–138 attacks, 142 keystrokes, 147–148 mouse movements, 147–148 passwords, 302 pools, 149 sources of, 147–148 EPROM, 313 Eratosthenes, 164 error-correcting code memory (ECC), 128 errors large integer arithmetic, 244 PIN code, 222 protocols, 221–222 timing attacks, 221–222 wooping, 247 ethics, trust, 214 Euclid, 165 extended Euclidian algorithm, 171–172 European Committee for Standardization (CEN), 317 even permutations, 49 ideal block ciphers, 50 events accumulator, 151 pools, 150–151 ■ E–F randomness, 154–155 evolving systems, security, 17–18 exception handling, 122 exclusive-or operation (XOR), 51 MAC, 93 memory, 126 modulo 2, 172–173 storage, 126 stream cipher, 69 execution states, protocols, 221 exhaustive search attack, 36 DES, 53 hash functions, 84 expiration time certificates, 279 clock, 260 keys, 278–279, 299 public keys, 278–279 exponentiations, 179 CRT, 198 extended Euclidean algorithm, 171–172 extendedGCD, 171–172 RSA, 200 F failure rate, adversarial setting, 244 fast expiration, CA, 290–291 FEAL, 55 Feistel construction, 52 Twofish, 57 Ferguson, Niels, 5, 11, 112, 132, 191, 222, 240, 260 Fermat test, 177 56-bits, DES, 51 file system updates, atomicity, 158 finally, 122 fingerprint, 77 fingerprint scanners, 308–309 finite fields, 169–170 firewall, LAN, 10 512-bit, 79 343 344 Index ■ F–I fixed IV, 66 floating point registers, 127 Fortuna, 142 forward secrets, 238 Foundations of Cryptography (Goldreich), 18 functional specification, 117 fundamental theorem of arithmetic, 165 G garbage collection, 122 Garner’s formula, 196–197 GCD See greatest common divisor GCM, 71 GMAC, 113 GenerateBlocks, 146–147 GenerateLargePrime, 174, 203 generateRSAKey, 204–205 generateRSAPrime, 203–204 generator See also pseudorandom number generators; random number generators pools, 151 randomness, 143–147 reseeds, 152 speed, 147 generic attacks, 14 block ciphers, 47 hash functions, 79 GMAC, 94–95 authentication, 94 GCM, 113 interface, 94 Goldbach conjecture, 165 Goldreich, Oded, 18 greatest common divisor (GCD), 170–171 groups, 169–170 DH, 182–183 Gutmann, Peter, 312 H Handbook of Applied Cryptography (Menezes, van Oorschot, and Vanstone), 18, 243 hard drive, secrets, 301 hash functions, 77–88 attacks, 79 birthday attacks, 84 block ciphers, 45 collisions, 84 CPU, 152 exhaustive search attack, 84 generic attacks, 79 ideal, 79, 151 iterative, 80, 93 length extension bug, 83–84 NIST, 78 partial-message collision, 84 pools, 152 random mapping, 84, 207 security, 78–79 testing, 244 universal, 94, 112–113 weaknesses, 83–87 Hellman, Martin, 181 HMAC, 86, 93–94 birthday attacks, 93 iterative hash functions, 93 key recovery attacks, 93 SHA-1, 93 Horton Principle, 96–97 message identifiers, 220 Housley, Russ, 112 human memory passwords, 302–303 secrets, 302–306 I iButton, 306 IDEA, 55 side-channel attacks, 250 Index ideals block ciphers, 46–50 hash functions, 79 MAC, 90 identifiers messages, 253–254 protocols, 253–254 IEEE See Electrical and Electronics Engineers IETF See Internet Engineering Task Force IKE See Internet Key Exchange implementation, 115–134 design, 117 incentive, protocols, 215–217 indirect authorization, 285 information leakage, 33, 72–75 DH, 248 initialization AES, 132 secure channel, 107–108 SSL, 37 initialization vector, 66 InitializeGenerator, 145 InitializePRNG, 153 InitializeSecureChannel, 113 insiders, 10 instance identifiers, protocols, 253–254 interface block ciphers, 45 GMAC, 94 International Organization for Standardization (ISO), 317 Internet Engineering Task Force (IETF), 317, 321 Internet Key Exchange (IKE), 191–192 Introduction to Modern Cryptography (Katz and Lindell), 18 IPsec, 101 message order, 111 iris scanners, 308–309 ISO See International Organization for Standardization ISO 9001, 119 isPrime, 175, 187 iterative hash functions, 80, 151 HMAC, 93 J Java, 122 K Kahn, David, 18 Katz, Jonathan, 18 Kelsey, John, 141 Kerberos, 270–271, 273 Kerckhoff’s principle, 24–25 algorithms, 44 block ciphers, 44 key(s) See also specific key types compromise of, 238 expiration time, 299 key servers, 272 phases of, 297–298 secure channel, 100 64-bit, 34–35 key negotiation, 227–242, 272 authentication, 227–228 passwords, 228, 241 secret keys, 228 key recovery attacks, HMAC, 93 key servers, 269–274 CRL, 292–293 keys, 272 PKI, 292–293 rekeying, 272–273 secure channel, 272 keystrokes entropy, 147–148 randomness, 138 known-plaintext attack, 31 distinguishers, 48 Knuth, Donald E., 140 Kohno, Tadayoshi, 112 ■ I–K 345 346 Index ■ L–M L LAN, firewall, 10 large integer arithmetic, 243–249 errors, 244 side-channel attacks, 245 wooping, 246 law, trust, 214 LCM See least common multiple least common multiple (LCM), 171 Legendre symbol, 187 length extension bug, hash functions, 83–84 liability CA, 30 VeriSign, 30 Lindell, Yehuda, 18 local time, 266 long-term card key, 240 M MAC See message authentication code MAD See Mutually Assured Destruction man-in-the-middle attack, DH, 184–185 MARS, 58 side-channel attacks, 250 mathematics, 75 RSA, 205 MD4, 81 MD5, 81 meet-in-the-middle attacks, 34–35 birthday attacks, 35 memory human, 302–306 secrets, 125–127 XOR, 126 memset, 121 Menezes, A.J., 18, 243 message authentication code (MAC), 26–27, 89–98 attacks, 90 authentication, 96, 102–104, 106 CBC, 91–93 data integrity, 127 encryption, 102–104 ideal, 90 meet-in-the-middle attacks, 35 passwords, 241 random mapping, 90, 93 security, 90 tags, 89, 103 XOR, 93 message digest functions See hash functions message identifiers Horton Principle, 220 protocols, 219–220 message numbers, 26–27, 102 secure channel, 105 message order authentication, 26 secure channel, 111–112 messages authentication, 229 encoding, 220 identifiers, 253–254 parsing, 220 protocols, 218–225, 253–255 secure channel, 100–101, 108–109 TCP, 219 MinPoolSize, 154 modular addition, 246 modular multiplication, 246 modularization, 129–130 protocols, 218, 240–241, 273 modulo addition, 168–169 multiplication, 169, 249–250 primes, 167–173 subtraction, 168–169 wooping, 245 modulo 2, 172–173 modulo n, 199–200 monotonicity, clock, 260 Monte Carlo simulation, 144 Montgomery multiplication, 179, 249–250 Index Moore’s law, 305 mouse movements, entropy, 147–148 MsgCntSend, 109 MsgToRSANumber, 209–210 multilevel certificates, 277–278 multiplication CPU, 251 CRT, 198 modular, 246 modulo, 169, 249–250 Montgomery, 179 multiplicative group modulo p, 170 Mutually Assured Destruction (MAD), 214 N names, PKI, 281–283 National Institute of Standards and Technology (NIST), 54 hash functions, 78 primes, 193 SHA, 82 network security, 14 NIST See National Institute of Standards and Technology nonce-generated IV, 67–68 GMAC, 94 nonrepudiation, 293 NSA, 80 SHA, 82 NTP, 264 O OCB, 112–113 OCSP See Online Certificate Status Protocol odd permutations, 49 OFB See output feedback offline chosen-plaintext attack, 32 dictionary attack, 241 128-bit, 60 AES, 54 ■ block ciphers, 43 GMAC, 94 MD5, 81 passwords, 302 security, 36 160-bit, 82 192-bit, 60 online certificate verification, 291 chosen-plaintext attack, 32 Online Certificate Status Protocol (OCSP), 291 output feedback (OFB), 68–69 information leakage, 73 overwriting data, 312–313 P padding block cipher mode, 64–65 RSA, 205–206 paranoia, exercises, 18–21 protocols, 218 parity, permutations, 49–50 parity attacks, 49 parsing, messages, 220 partial-message collision, hash functions, 84 passphrases, 303 Password Safe, 309 passwords, dictionary attack, 228 entropy, 302 human memory, 302–303 key negotiation, 228, 241 MAC, 241 128-bit, 302 salting, 304–306 64-bit, 303 stretching, 304–306 256-bit, 302 patents, 322 PayPal, phishing, 218 PC Card, 306 M–P 347 348 Index ■ P PDA, secrets, 301 performance, security, 14–17, 37 permutations block ciphers, 44, 46 even, 49, 50 odd, 49 parity, 49–50 phishing, PayPal, 218 PHT, 57 physical threat, trust, 214 PIN code ATM, 288 credit cards, 11 errors, 222 secure token, 307–308 SET, 11 PKCS#1 v2.1, 206 PKI See public key infrastructure plaintext, 24 attacks, 69 block cipher mode, 64 block ciphers, 43, 49–50 ciphertext c, 64 pools accumulator, 151 entropy, 149 events, 150–151 generator, 151 hash functions, 152 randomness, 148–150 reseeds, 149 portable storage, 306 powers, 179 prevention, security, 16 primes, 163–180 algorithms, 164 divisibility, 163–166 large, 173–179 modulo, 167–173 NIST, 193 primitive elements, 173 safe, 186–187 small, 166–167 testing, 176–178 256-bit, 190 wooping, 245 primitive elements, 17, 36, 44, 64, 93, 100, 182 primes, 173 privacy, storage, 283 private keys, 202–203 PRNGs See pseudorandom number generators probabilities, 75 professional paranoia, exercises, 18–21 protocols, 218 proof by contradiction, 165 proof of security, 299 protocols, 213–225 See also specific protocols authentication, 97 complexity, 238–241 errors, 221–222 execution states, 221 identifiers, 253–254 incentive, 215–217 instance identifiers, 253–254 message identifiers, 219–220 messages, 218–225, 253–255 modularization, 218, 240–241, 273 paranoia, 218 professional paranoia, 218 roles, 213–214 secure channel, 253 smart cards, 240 steps, 218–225 timeouts, 255 trust, 214–215, 217–218 versions, 229–230 pseudorandom data, 140 pseudorandom function, 143–147 pseudorandom number generators (PRNGs), 140–142 PseudoRandomData, 146–147, 152 public exponents, RSA, 201–202 public key(s) algorithms, 28 Index authentication, 189 DH, 239 digital signature, 29, 30 efficiency, 28 encryption, 27–29, 189 expiration time, 278–279 PKI, 275–276 primes, 163–180 RSA, 239 secret keys, 28, 275–276 SSL, 37 symmetric keys, 29, 188–189 timing attacks, 250–251 public key infrastructure (PKI), 29–30 authorization, 285–286 CA, 275–276, 283–285 certificates, 275, 277–278, 295–297 clock, 264 credential systems, 286–288 dream of, 275–280 key servers, 292–293 names, 281–283 practicalities, 295–300 public keys, 275–276 reality of, 281–294 refinery sensors, 277 revocation, 289–292 secret keys, 275–276 SSL, 321 trust, 284–285 universal, 276, 284 VPN, 276 Q quantum physics, attacks, 139 R RA See Registration Authority Rabin-Miller test, 175–178 random delay, 251 random IV, 66–67 random mapping hash functions, 84, 207 ■ P–R MAC, 90, 93 random number generators, 139 same-state problem, 265 RandomData, 152, 153 randomness, 137–161 accumulator, 147–155 events, 154–155 generator, 143–147 keystrokes, 138 pools, 148–150 secret keys, 12 RC4, 323–324 RC6, 58 real-time clock chip, 261 same-state problem, 265 real-time transactions, clock, 260–261 ReceiveMessage, 110–111 reductio ad absurdum (proof by contradiction), 165 refinery sensors, PKI, 277 registers, CPU, 127 Registration Authority (RA), CA, 279–280 rekeying, key servers, 272–273 related-key attack, 45 replay attacks, 223–225 reputation, trust, 214 requirements, 117 ReseedCnt, 154 reseeds, 145 generator, 152 pools, 149 resends secure channel, 102 timing of, 255 response, security, 16 retry attacks, 223–225 TCP, 223 UDP packets, 223 revocation, PKI, 289–292 RF attacks, 252 side-channel attacks, 132 349 350 Index ■ R–S Rijndael, 54 randomness generator, 143 risk, trust, 215 Rivest, Ron, 81, 195 roles protocols, 213–214 secure channel, 99–100 root key, CA, 293, 296–297 rounds AES, 54–55 block ciphers, 50–51 DES, 51–52 RSA, 195–211 AES, 205 attacks, 205 decryption, 207–208, 251 digital signature, 200 encryption, 206–209, 248 extendedGCD, 200 mathematics, 205 padding, 205–206 pitfalls, 205–206 public exponents, 201–202 public keys, 239 signatures, 239, 248 SSL, 251 symmetric keys, 302 testing, 248–249 RSA-OAEP, 206 RSA-PSS, 206 S safe primes DH, 186–187 efficiency, 187 salting, passwords, 304–306 same-state problem, 265–266 S-box See substitution box Schilder, Marius, 240 Schneier, Bruce, 18, 323, 326 secret keys authentication, 26 block ciphers, 43 encryption, 24 key negotiation, 228 management, 14 PKI, 275–276 public keys, 28, 275–276 randomness, 12 secure tokens, 307 storage, 12, 14 256-bit, 306 secrets, 120–128 cache, 124 CPU, 122 forward, 238 hard drive, 301 human memory, 302–306 memory, 125–127 PDA, 301 secure channel, 101–102, 120 sharing, 310–311 smart phones, 301 storage, 301–314 swap files, 122–124 virtual memory, 122–124 wiping state, 311–313 Secrets and Lies (Scheier), 18, 326 secure channel, 99–114 algorithms, 107–112 authentication, 102–104, 106 encryption, 102–104, 106–107 initialization, 107–108 key servers, 272 keys, 100 message numbers, 105 message order, 111–112 messages, 100–101, 108–109 properties, 101–102 protocols, 253 resends, 102 roles, 99–100 secrets, 101–102, 120 Secure Hash Algorithm (SHA), 79, 82 secure tokens, 306–308 PIN code, 307–308 secret keys, 307 secure UI, 307–308 Index security clock, 262–263 complexity, 129 detection, 16 evolving systems, 17–18 features, 17 hash functions, 78–79 level, 36 MAC, 90 mindset, 128-bit, 36 performance, 14–17, 37 prevention, 16 response, 16 reviews, 20–21 standards, 320 weakest link, 5–7 Security Engineering (Anderson), 18 seed files, 155–159 self-certifying certificate, 296 SendMessage, 109 sequences, 27 Serpent, 56–57 randomness generator, 143 session keys, 228 authentication, 229 SET credit cards, 10–11 digital signature, 11 PIN code, 11 viruses, 11 SHA See Secure Hash Algorithm SHA-0, 82 SHA-1, 79, 82 HMAC, 93 SHA-2, fixes for, 85–87 SHA-3, 78, 79–80 SHA-224, 82–83 SHA-256, 79, 82–83 SHA-384, 79, 82–83 SHA-512, 79, 82–83 Shamir, Adi, 195 side-channel attacks, 33, 132–133, 250–252 ■ countermeasures, 251–252 IDEA, 250 large integer arithmetic, 245 MARS, 250 RF, 132 signatures See also digital signature blind, 252 CRT, 239 RSA, 209–211, 239, 248 SignWithRSA, 210 simplicity, 129 single sign-on, 309 64-bit DES, 52 encryption, 106 keys, 34–35 message numbers, 105 passwords, 303 SmallPrimeList, 166 smart cards, 222, 306 protocols, 240 smart phones, secrets, 301 SNTP, 264 Social Security number (SSN), 283 SoFi number, 283 software bugs, 14 specifications, 117–118 splitting operations, 110 SRAM See Static RAM SRP, 241 SSH, 101 SSL certificates, 218 initialization, 37 PKI, 321 public keys, 37 RSA, 251 standards, 320–321 SSL/TLS, 101 SSN See Social Security number standards, 317–322 security, 320 SSL, 320–321 start-of-protocol attack, 255 S 351 352 Index ■ S–T Static RAM (SRAM), 125 Station-to-Station protocol, DH, 228 steps attacks, 36 protocols, 218–225 storage encryption, 24 portable, 306 privacy, 283 secret keys, 12, 14 secrets, 301–314 XOR, 126 stream cipher, 68 collision attacks, 69 XOR, 69 stretching, passwords, 304–306 STU-III, 290 subgroups, DH, 187–188, 191 subsequences, 27 substitution box (S-box), 52 AES, 54 Twofish, 57 subtraction, modulo, 168–169 Sun Tzu, 196 superusers, 127, 128 swap files, secrets, 122–124 symmetric keys authentication, 239 encryption, 28 public keys, 29, 188–189 RSA, 302 SYN flood attack, 255 System.gc(), 122 System.runFinalization(), 122 T Tag-Length-Value (TLV), 220 tags, MAC, 89, 103 TCP messages, 219 retry attacks, 223 TCP/IP, 101 message order, 112 test-and-fix complexity, 37–38 correct programs, 118 testing, 13, 131–132 AES, 244 block ciphers, 244 DH, 248 Fermat, 177 hash functions, 244 primes, 176–178 Rabin-Miller, 175–178 RSA, 248–249 32-bit encryption, 106–107 MD4, 81 message numbers, 105 SHA-1, 82 threat model, 10–12 time, clock, 266–267 time server, 264 time stamps, 260 time synchronization, clock, 264 timeouts, protocols, 255 timing attacks errors, 221–222 public keys, 250–251 TLS, 321 TLV See Tag-Length-Value traffic analysis, 101 transient secrets, 120 transport layer, 219 trust CA, 30 ethics, 214 law, 214 MAD, 214 physical threat, 214 PKI, 284–285 protocols, 214–215, 217–218 reputation, 214 risk, 215 try-finally, 122 256-bit, 60 block ciphers, 43 passwords, 302 Index primes, 190 secret keys, 306 Twofish, 45, 57–58 randomness generator, 143 U UDP packets, 219 retry attacks, 223 uncertainty, 137 unique value, clock, 260 universal hash function, 94 CWC, 112–113 universal PKI, 276, 284 UNIX, 127 UpdateSeedFile, 156 USB dongle, 306 USB stick, 12 storage, 306 UTC, 267 V van Oorschot, Paul C., 18, 243 Vanstone, S.A., 18, 243 VerifyRSASignature, 210 VeriSign, liability, 30 version-rollback attack, 230 versions, protocols, 229–230 Viega, John, 112 virtual machines (VMs), 141–142 backups, 157–158 virtual memory, secrets, 122–124 virtual private network (VPN), PKI, 276 viruses credit cards, 11 SET, 11 ■ T–Z VMs See virtual machines VPN See virtual private network W weakest link, security, 5–7 WEP See wired equivalent privacy whitening, 57 Whiting, Doug, 112 wiping state, 121–122 secrets, 311–313 wired equivalent privacy (WEP), 323–324 wooping, 245–248 algorithms, 246 errors, 247 large integer arithmetic, 246 modulo, 245 primes, 245 WriteSeedFile, 156 X XML, 221, 295 XOR See exclusive-or operation X.509v3, 279, 295 Y Yarrow, 141 Z Zener diode, 139 353

Ngày đăng: 29/10/2019, 14:17

Từ khóa liên quan

Mục lục

  • Cryptography Engineering: Design Principles and Practical Applications

  • Credits

  • About the Authors

  • Acknowledgments for Cryptography Engineering

  • Acknowledgments for Practical Cryptography (the 1st Edition)

  • Contents at a Glance

  • Contents

  • Preface to Cryptography Engineering

    • History

    • Example Syllabi

    • Additional Information

  • Preface to Practical Cryptography (the 1st Edition)

    • How to Read this Book

  • Part I: Introduction

    • In This Part

    • Chapter 1: The Context of Cryptography

      • 1.1: The Role of Cryptography

      • 1.2: The Weakest Link Property

      • 1.3: The Adversarial Setting

      • 1.4: Professional Paranoia

        • 1.4.1: Broader Benefits

        • 1.4.2: Discussing Attacks

      • 1.5: Threat Model

      • 1.6: Cryptography Is Not the Solution

      • 1.7: Cryptography Is Very Difficult

      • 1.8: Cryptography Is the Easy Part

      • 1.9: Generic Attacks

      • 1.10: Security and Other Design Criteria

        • 1.10.1: Security Versus Performance

        • 1.10.2: Security Versus Features

        • 1.10.3: Security Versus Evolving Systems

      • 1.11: Further Reading

      • 1.12: Exercises for Professional Paranoia

        • 1.12.1: Current Event Exercises

        • 1.12.2: Security Review Exercises

      • 1.13: General Exercises

    • Chapter 2: Introduction to Cryptography

      • 2.1: Encryption

        • 2.1.1: Kerckhoffs' Principle

      • 2.2: Authentication

      • 2.3: Public-Key Encryption

      • 2.4: Digital Signatures

      • 2.5: PKI

      • 2.6: Attacks

        • 2.6.1: The Ciphertext-Only Model

        • 2.6.2: The Known-Plaintext Model

        • 2.6.3: The Chosen-Plaintext Model

        • 2.6.4: The Chosen-Ciphertext Model

        • 2.6.5: The Distinguishing Attack Goal

        • 2.6.6: Other Types of Attack

      • 2.7: Under the Hood

        • 2.7.1: Birthday Attacks

        • 2.7.2: Meet-in-the-Middle Attacks

      • 2.8: Security Level

      • 2.9: Performance

      • 2.10: Complexity

      • 2.11: Exercises

  • Part II: Message Security

    • Chapter 3: Block Ciphers

      • 3.1: What Is a Block Cipher?

      • 3.2: Types of Attack

      • 3.3: The Ideal Block Cipher

      • 3.4: Definition of Block Cipher Security

        • 3.4.1: Parity of a Permutation

      • 3.5: Real Block Ciphers

        • 3.5.1: DES

        • 3.5.2: AES

        • 3.5.3: Serpent

        • 3.5.4: Twofish

        • 3.5.5: Other AES Finalists

        • 3.5.6: Which Block Cipher Should I Choose?

        • 3.5.7: What Key Size Should I Use?

      • 3.6: Exercises

    • Chapter 4: Block Cipher Modes

      • 4.1: Padding

      • 4.2: ECB

      • 4.3: CBC

        • 4.3.1: Fixed IV

        • 4.3.2: Counter IV

        • 4.3.3: Random IV

        • 4.3.4: Nonce-Generated IV

      • 4.4: OFB

      • 4.5: CTR

      • 4.6: Combined Encryption and Authentication

      • 4.7: Which Mode Should I Use?

      • 4.8: Information Leakage

        • 4.8.1: Chances of a Collision

        • 4.8.2: How to Deal With Leakage

        • 4.8.3: About Our Math

      • 4.9: Exercises

    • Chapter 5: Hash Functions

      • 5.1: Security of Hash Functions

      • 5.2: Real Hash Functions

        • 5.2.1: A Simple But Insecure Hash Function

        • 5.2.2: MD5

        • 5.2.3: SHA-1

        • 5.2.4: SHA-224, SHA-256, SHA-384, and SHA-512

      • 5.3: Weaknesses of Hash Functions

        • 5.3.1: Length Extensions

        • 5.3.2: Partial-Message Collision

      • 5.4: Fixing the Weaknesses

        • 5.4.1: Toward a Short-term Fix

        • 5.4.2: A More Efficient Short-term Fix

        • 5.4.3: Another Fix

      • 5.5: Which Hash Function Should I Choose?

      • 5.6: Exercises

    • Chapter 6: Message Authentication Codes

      • 6.1: What a MAC Does

      • 6.2: The Ideal MAC and MAC Security

      • 6.3: CBC-MAC and CMAC

      • 6.4: HMAC

      • 6.5: GMAC

      • 6.6: Which MAC to Choose?

      • 6.7: Using a MAC

      • 6.8: Exercises

    • Chapter 7: The Secure Channel

      • 7.1: Properties of a Secure Channel

      • 7.1.1: Roles

      • 7.1.2: Key

      • 7.1.3: Messages or Stream

      • 7.1.4: Security Properties

      • 7.2: Order of Authentication and Encryption

      • 7.3: Designing a Secure Channel: Overview

        • 7.3.1: Message Numbers

        • 7.3.2: Authentication

        • 7.3.3: Encryption

        • 7.3.4: Frame Format

      • 7.4: Design Details

        • 7.4.1: Initialization

        • 7.4.2: Sending a Message

        • 7.4.3: Receiving a Message

        • 7.4.4: Message Order

      • 7.5: Alternatives

      • 7.6: Exercises

    • Chapter 8: Implementation Issues (I)

      • 8.1: Creating Correct Programs

        • 8.1.1: Specifications

        • 8.1.2: Test and Fix

        • 8.1.3: Lax Attitude

        • 8.1.4: So How Do We Proceed?

      • 8.2: Creating Secure Software

      • 8.3: Keeping Secrets

        • 8.3.1: Wiping State

        • 8.3.2: Swap File

        • 8.3.3: Caches

        • 8.3.4: Data Retention by Memory

        • 8.3.5: Access by Others

        • 8.3.6: Data Integrity

        • 8.3.7: What to Do

      • 8.4: Quality of Code

        • 8.4.1: Simplicity

        • 8.4.2: Modularization

        • 8.4.3: Assertions

        • 8.4.4: Buffer Overflows

        • 8.4.5: Testing

      • 8.5: Side-Channel Attacks

      • 8.6: Beyond this Chapter

      • 8.7: Exercises

  • Part III: Key Negotiation

    • Chapter 9: Generating Randomness

      • 9.1: Real Random

        • 9.1.1: Problems With Using Real Random Data

        • 9.1.2: Pseudorandom Data

        • 9.1.3: Real Random Data and PRNGS

      • 9.2: Attack Models for a PRNG

      • 9.3: Fortuna

      • 9.4: The Generator

        • 9.4.1: Initialization

        • 9.4.2: Reseed

        • 9.4.3: Generate Blocks

        • 9.4.4: Generate Random Data

        • 9.4.5: Generator Speed

      • 9.5: Accumulator

        • 9.5.1: Entropy Sources

        • 9.5.2: Pools

        • 9.5.3: Implementation Considerations

          • 9.5.3.1: Distribution of Events Over Pools

          • 9.5.3.2: Running Time of Event Passing

        • 9.5.4: Initialization

        • 9.5.5: Getting Random Data

        • 9.5.6: Add an Event

      • 9.6: Seed File Management

        • 9.6.1: Write Seed File

        • 9.6.2: Update Seed File

        • 9.6.3: When to Read and Write the Seed File

        • 9.6.4: Backups and Virtual Machines

        • 9.6.5: Atomicity of File System Updates

        • 9.6.6: First Boot

      • 9.7: Choosing Random Elements

      • 9.8: Exercises

    • Chapter 10: Primes

      • 10.1: Divisibility and Primes

      • 10.2: Generating Small Primes

      • 10.3: Computations Modulo a Prime

        • 10.3.1: Addition and Subtraction

        • 10.3.2: Multiplication

        • 10.3.3: Groups and Finite Fields

        • 10.3.4: The GCD Algorithm

        • 10.3.5: The Extended Euclidean Algorithm

        • 10.3.6: Working Modulo 2

      • 10.4: Large Primes

        • 10.4.1: Primality Testing

        • 10.4.2: Evaluating Powers

      • 10.5: Exercises

    • Chapter 11: Diffie-Hellman

      • 11.1: Groups

      • 11.2: Basic DH

      • 11.3: Man in the Middle

      • 11.4: Pitfalls

      • 11.5: Safe Primes

      • 11.6: Using a Smaller Subgroup

      • 11.7: The Size of p

      • 11.8: Practical Rules

      • 11.9: What Can Go Wrong?

      • 11.10: Exercises

    • Chapter 12: RSA

      • 12.1: Introduction

      • 12.2: The Chinese Remainder Theorem

        • 12.2.1: Garner's Formula

        • 12.2.2: Generalizations

        • 12.2.3: Uses

        • 12.2.4: Conclusion

      • 12.3: Multiplication Modulo n

      • 12.4: RSA Defined

        • 12.4.1: Digital Signatures with RSA

        • 12.4.2: Public Exponents

        • 12.4.3: The Private Key

        • 12.4.4: The Size of n

        • 12.4.5: Generating RSA Keys

      • 12.5: Pitfalls Using RSA

      • 12.6: Encryption

      • 12.7: Signatures

      • 12.8: Exercises

    • Chapter 13: Introduction to Cryptographic Protocols

      • 13.1: Roles

      • 13.2: Trust

        • 13.2.1: Risk

      • 13.3: Incentive

      • 13.4: Trust in Cryptographic Protocols

      • 13.5: Messages and Steps

        • 13.5.1: The Transport Layer

        • 13.5.2: Protocol and Message Identity

        • 13.5.3: Message Encoding and Parsing

        • 13.5.4: Protocol Execution States

        • 13.5.5: Errors

        • 13.5.6: Replay and Retries

      • 13.6: Exercises

    • Chapter 14: Key Negotiation

      • 14.1: The Setting

      • 14.2: A First Try

      • 14.3: Protocols Live Forever

      • 14.4: An Authentication Convention

      • 14.5: A Second Attempt

      • 14.6: A Third Attempt

      • 14.7: The Final Protocol

      • 14.8: Different Views of the Protocol

        • 14.8.1: Alice's View

        • 14.8.2: Bob's View

        • 14.8.3: Attacker's View

        • 14.8.4: Key Compromise

      • 14.9: Computational Complexity of the Protocol

        • 14.9.1: Optimization Tricks

      • 14.10: Protocol Complexity

      • 14.11: A Gentle Warning

      • 14.12: Key Negotiation from a Password

      • 14.13: Exercises

    • Chapter 15: Implementation Issues (II)

      • 15.1: Large Integer Arithmetic

        • 15.1.1: Wooping

        • 15.1.2: Checking DH Computations

        • 15.1.3: Checking RSA Encryption

        • 15.1.4: Checking RSA Signatures

        • 15.1.5: Conclusion

      • 15.2: Faster Multiplication

      • 15.3: Side-Channel Attacks

        • 15.3.1: Countermeasures

      • 15.4: Protocols

        • 15.4.1: Protocols Over a Secure Channel

        • 15.4.2: Receiving a Message

        • 15.4.3: Timeouts

      • 15.5: Exercises

  • Part IV: Key Management

    • Chapter 16: The Clock

      • 16.1: Uses for a Clock

        • 16.1.1: Expiration

        • 16.1.2: Unique Value

        • 16.1.3: Monotonicity

        • 16.1.4: Real-Time Transactions

      • 16.2: Using the Real-Time Clock Chip

      • 16.3: Security Dangers

        • 16.3.1: Setting the Clock Back

        • 16.3.2: Stopping the Clock

        • 16.3.3: Setting the Clock Forward

      • 16.4: Creating a Reliable Clock

      • 16.5: The Same-State Problem

      • 16.6: Time

      • 16.7: Closing Recommendations

      • 16.8: Exercises

    • Chapter 17: Key Servers

      • 17.1: Basics

      • 17.2: Kerberos

      • 17.3: Simpler Solutions

        • 17.3.1: Secure Connection

        • 17.3.2: Setting Up a Key

        • 17.3.3: Rekeying

        • 17.3.4: Other Properties

      • 17.4: What to Choose

      • 17.5: Exercises

    • Chapter 18: The Dream of PKI

      • 18.1: A Very Short PKI Overview

      • 18.2: PKI Examples

        • 18.2.1: The Universal PKI

        • 18.2.2: VPN Access

        • 18.2.3: Electronic Banking

        • 18.2.4: Refinery Sensors

        • 18.2.5: Credit Card Organization

      • 18.3: Additional Details

        • 18.3.1: Multilevel Certificates

        • 18.3.2: Expiration

        • 18.3.3: Separate Registration Authority

      • 18.4: Summary

      • 18.5: Exercises

    • Chapter 19: PKI Reality

      • 19.1: Names

      • 19.2: Authority

      • 19.3: Trust

      • 19.4: Indirect Authorization

      • 19.5: Direct Authorization

      • 19.6: Credential Systems

      • 19.7: The Modified Dream

      • 19.8: Revocation

        • 19.8.1: Revocation List

        • 19.8.2: Fast Expiration

        • 19.8.3: Online Certificate Verification

        • 19.8.4: Revocation Is Required

      • 19.9: So What Is a PKI Good For?

      • 19.10: What to Choose

      • 19.11: Exercises

    • Chapter 20: PKI Practicalities

      • 20.1: Certificate Format

        • 20.1.1: Permission Language

        • 20.1.2: The Root Key

      • 20.2: The Life of a Key

      • 20.3: Why Keys Wear Out

      • 20.4: Going Further

      • 20.5: Exercises

    • Chapter 21: Storing Secrets

      • 21.1: Disk

      • 21.2: Human Memory

        • 21.2.1: Salting and Stretching

      • 21.3: Portable Storage

      • 21.4: Secure Token

      • 21.5: Secure UI

      • 21.6: Biometrics

      • 21.7: Single Sign-On

      • 21.8: Risk of Loss

      • 21.9: Secret Sharing

      • 21.10: Wiping Secrets

        • 21.10.1: Paper

        • 21.10.2: Magnetic Storage

        • 21.10.3: Solid-State Storage

      • 21.11: Exercises

  • Part V: Miscellaneous

    • Chapter 22: Standards and Patents

      • 22.1: Standards

        • 22.1.1: The Standards Process

          • 22.1.1.1: The Standard

          • 22.1.1.2: Functionality

          • 22.1.1.3: Security

        • 22.1.2: SSL

        • 22.1.3: AES: Standardization by Competition

      • 22.2: Patents

    • Chapter 23: Involving Experts

  • Bibliography

  • Index

Tài liệu cùng người dùng

  • Đang cập nhật ...

Tài liệu liên quan