Ngày đăng: 29/10/2019, 14:17
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 speciﬁcally disclaim all warranties, including without limitation warranties of ﬁtness 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 afﬁliates, 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 Wakeﬁeld 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 Twoﬁsh 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 inﬂuential 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 testiﬁed before Congress on multiple occasions, and has served on several government technical committees Schneier is the Chief Security Technology Ofﬁcer 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 deﬁbrillators 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 efﬁciency, 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, ﬁle system updates, 158 attack tree, 5–6 attacks, 31–33 See also speciﬁc 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 overﬂow, 131 C C++, 121–122 CA See certiﬁcate 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 certiﬁcate(s), 30 credential systems, 286–288 multilevel, 277–278 PKI, 275, 277–278, 295–297 self-certifying, 296 SSL, 218 certiﬁcate 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 certiﬁcate chain, 277 certiﬁcate 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-ﬁx, 37–38 composites, 164 constant-time operations, 252 conventions, authentication, 230–231 correct programs, 116–119 test-and-ﬁx, 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 certiﬁcate 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 Difﬁe-Hellman key exchange protocol dictionary attack ofﬂine, 241 passwords, 228 Difﬁe, Whitﬁeld, 181 Difﬁe-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 Deﬁnition (DTD), 221 DOS See denial-of-service attack DRAM See Dynamic RAM DRM See digital rights management DTD See Document Template Deﬁnition Dynamic RAM (DRAM), 125 E EC See error-correcting code memory ECB See electronic cookbook EEPROM, 313 efﬁciency, 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 certiﬁcates, 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 Twoﬁsh, 57 Ferguson, Niels, 5, 11, 112, 132, 191, 222, 240, 260 Fermat test, 177 56-bits, DES, 51 ﬁle system updates, atomicity, 158 finally, 122 ﬁngerprint, 77 ﬁngerprint scanners, 308–309 ﬁnite ﬁelds, 169–170 ﬁrewall, LAN, 10 512-bit, 79 343 344 Index ■ F–I ﬁxed IV, 66 ﬂoating point registers, 127 Fortuna, 142 forward secrets, 238 Foundations of Cryptography (Goldreich), 18 functional speciﬁcation, 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 identiﬁers, 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 identiﬁers 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 identiﬁers, 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 speciﬁc 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, ﬁrewall, 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 identiﬁers 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 identiﬁers, 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 certiﬁcates, 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 Certiﬁcate Status Protocol odd permutations, 49 OFB See output feedback ofﬂine 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 certiﬁcate veriﬁcation, 291 chosen-plaintext attack, 32 Online Certiﬁcate 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 speciﬁc protocols authentication, 97 complexity, 238–241 errors, 221–222 execution states, 221 identiﬁers, 253–254 incentive, 215–217 instance identiﬁers, 253–254 message identiﬁers, 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 efﬁciency, 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 certiﬁcates, 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 reﬁnery 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 reﬁnery 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 efﬁciency, 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 ﬁles, 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 ﬁles, 155–159 self-certifying certiﬁcate, 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, ﬁxes 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 speciﬁcations, 117–118 splitting operations, 110 SRAM See Static RAM SRP, 241 SSH, 101 SSL certiﬁcates, 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 Twoﬁsh, 57 subtraction, modulo, 168–169 Sun Tzu, 196 superusers, 127, 128 swap ﬁles, secrets, 122–124 symmetric keys authentication, 239 encryption, 28 public keys, 29, 188–189 RSA, 302 SYN ﬂood 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-ﬁx 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 trafﬁc 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 Twoﬁsh, 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
- Xem thêm -
Xem thêm: Hacking ebook cryptography engineering design principles and practical applications , Hacking ebook cryptography engineering design principles and practical applications , 2: The Weakest Link Property, 10: Security and Other Design Criteria, 12: Exercises for Professional Paranoia, 1: What Is a Block Cipher?, 4: Definition of Block Cipher Security, 7: Which Mode Should I Use?, 1: Security of Hash Functions, 3: Weaknesses of Hash Functions, 2: The Ideal MAC and MAC Security, 6: Which MAC to Choose?, 1: Properties of a Secure Channel, 3: Designing a Secure Channel: Overview, 2: Attack Models for a PRNG, 3: Computations Modulo a Prime, 3: Man in the Middle, 7: The Size of p, 9: What Can Go Wrong?, 2: The Chinese Remainder Theorem, 4: Trust in Cryptographic Protocols, 8: Different Views of the Protocol, 9: Computational Complexity of the Protocol, 12: Key Negotiation from a Password, 2: Using the Real-Time Clock Chip, 4: Creating a Reliable Clock, 1: A Very Short PKI Overview, 9: So What Is a PKI Good For?, 3: Why Keys Wear Out