作者:empty 页数:449 出版社:empty |
Syngress would like to acknowledge the following people for their kindnessand support in making this book possibleSyngress books are now distributed in the United States and Canada byO Reily Media, Inc.The enthusiasm and work ethic at OReilly are incredibleand we would like to thank everyone there for their time and efforts to bringSyngressbookstomarket:TimO'Reilly, Laura Baldwin, Mark Brokering, MikeLeonard, Donna Selen ko, Bonnie Sheehan, Cindy Davis.Grant Kik kert, O polMatsu taro, Steve Hazelwood, Mark Wilson, Rick Brown, Tim Hinton, KyleHart, Sara Winge, Peter Pardo, Leslie Crandell, Regina Ag gio Wilkinson, PascalHons cher, Preston Paull, Susan Thompson, Bruce Stewart, Laura Sch mier, SueWilling.Mark Jacsen, Betsy Wal is zew ski, Kathryn Barrett, John Cho dack i.R Bull ngt on, Kerry Beck, Karen Montgomery, and Patrick Dir den.The incredibly hardworking team at Elsevier Science, includi g JonathanBunk ell, Ian Seager, Duncan Enright, David Burton.Rosanna Rama c ciotti,Rert Fairbrother, Miguel Sanchez, Klaus Beran, Emma Wyatt, KristaLep piko, Marcel Koppes.Judy Chappell, Radek Janousek, Rosie Moss, DavidLockley, Nicola Haden, Bill Kennedy, Martina Morris, Kai Wu er fl-David ek,Christiane Leiper s berger.Yvonne Gruene klee, Nadia Bala vo in e, and ChrisReinders for making certain that our vision remains worldwide in scopeDavid Buck and, Marie Chieng, Lucy Chong, Lelie Lim, Audrey Gan, PangA iHua.Joseph Chan, June Lim, and SitiZuraidahAhmadofPan sing Distributorsfor the enthusiasm with which they receive our booksDavid Scott, Tricia Widen, Mari la Burgess, Annette Scott AndrewS waff erStephen O'Donoghue, Be cLowe, Mark Langley, and Any o Geddes of Woodslanefor distributing our books throughout Australia, NewZealand, Papua NewGuinea.Fiji.Tonga, Solomon Islands, and the Cook Islands.
Lead AuthorTo mSt Denis is a software developer known best for his Lib Tomseries of public domain cryptographic libraries.He has spent the lastfive years distributing, developing, and supporting the cause of opensource cryptography, and has championed its safe deployment.Tomcurrently is employed for Elliptic Semiconductor Inc.where hedesigns and develops software libraries for embedded systems.Heworks closely with a team of diverse hardware engineers to create abest of breed hardware and software combination,Tom is also the author(with Greg Rose) of BigNum Math:Implement ig Cryptographic Multiple Precision Arithmetic(SyngressPublishing.ISBN:1-59749-112-8) , which discusses the deploymentof cry py to graphic integer mathematics.Technical Editor and CoauthorSimon Johnson is a security engineer for a technology outfit basedin the United Kingdom.Simon became interested in cryptographyduring his teenage years, studying all aspects of conventional soft-ware cryptography.He has been an active contributor to the crypto-graphic usenet group Sci.Crypt since the age of 17, attends varioussecurity conferences around the world, and continues to openlypromote safe computing practices.
Contents
Preface.
Chapter 1 Introduction
Introduction.
Threat Models.
What Is Cryptography?
Cryptographic Goals
Privacy
Integrity
Authentication
Non repudiation
Goals in a Nutshell
Asset Management.
Privacy and Authentication
Life of Data
Common Wisdom.
Developer Tools.
Summary.
Organization
FrequentlyAskedQuestions
Chapter 2ASN. 1 Encoding.
Overview of ASN.1.
ASN. 1 Syntax.
ASN.1Expliit Values
ASN. 1 Containers,
ASN. 1 Modifiers.
OPTIONAL
DEFAULT
CHOICE.
ASN. 1 DataTypes.
ASN. 1 Header Byte
Classification Bits.
Constructed Bit
Primitive Types.
ASN. 1 Length Encodings
Short Encodings.
Long Encodings
ASN. 1 Boolean Type.
ASN. 1 Integer Type.
ASN.1BIT STRINGType.
ASN. 1 OCTETSTRING Type.
ASN.1NULL Type.
ASN. 1 OBJECT IDENTIFIER Type.
ASN. 1 SEQUENCE and SET Types
SEQUENCE OF.
SET.
SET OF.
BOOLEAN Encoding:
INTEGER Encoding.
BITSTRING Encoding.
OCTETSTRING Encodings
NULL Encoding.
OBJECT IDENTIFIER Enco digs
Introduction.
Concept of Random
ASN.1 PrintableString and I A 5 STRING Types.
ASN.1UTC TIME Type.
Implementation.
ASN. 1 Length Routines
ASN. 1 Primitive Encoders
Puting It All Together.
PRINTABLE and I A 5 STRING Encodings.
UTC TIME Encodings.
SEQUENCE Encodings.
ASN.1Flexi Decoder78
Building Lists.83
Nested Lists,.85
Decoding Lists.86
Flexi Lists, -.87
Other Providers.89
FrequentlyAskedQuestions.90
Chapter 3 Random Number Generation.91
Measuring Entropy.
How Bad Can It Be?
RNG Desig.
Bit Count
WordCount.
Gap Space Count
Autocorrelation Test
RNG Events.
Hardware Interrupts
Timer Skew.
Analogue to Digital Errors
RNG Data Gathering.
LFSR Basics.
Table-based LFSR s.
Large LFSR Implementation
RNG Processing and Output.
RNG Estimation.
Keyboard and Mouse
Timer
Generic Devices
RNG Setup
PRNG Algorithms
PRNG Design
Bit Extractors.
Seeding and Life me
PRNG Attacks.
Input Control
Mall eabi ity Attacks
Backtracking Attacks.
Yarrow PRNG
Design.
Reseeding.
State fulness.
Pros and Cons.
Fortuna PRNG.
xiiContents
Design.
Reseeding
State fulness.
Pros and Cons.
NIST Hash Based DR BG
Design.
Reseeding:.
State fulness.
Pros and Cons
Putting It All Together
RNG versus PRNG
Fuse Bits.
Use of PRNG s
Example Platforms
Desktop and Server.
Consoles
Network Appliances
FrequentlyAskedQuestions
Block Ciphers-
AES Design
Chapter 4 Advanced Encryption Standard.
Introduction.
Implement a ion.
Finite Field Math
Add Round Key.
Sub Bytes.
Hardware Friendly Sub Bytes
Shift Rows
Mix Columns
Last Round
Inverse Cipher
Key Schedule.
An Eight-Bit Implementation
Optimized Eight-Bit Implementation
Key Schedule Changes.
Optimized 32-Bit Implementation.
Practical Attacks
Contents
Precomputed Tables.
Decryption Tables,
Macros.
Key Schedule
Performance.
x 86 Performance
ARM Performance.
What'sinan IV?.
Message Lengths.
Decryption.
Performance Downsides
Implementation
Message Lengths.
Decryption,
Performance-
Security.
Implementation
Keying Your Cipher++
Rekeying Your Cipher
Bi-Directional Channels
Lossy Channels.
Performance of the Small Variant.
Inverse Key Schedule.
Side Channels.
Processor Caches,
Associative Caches
Cache Organization
Bernstein Attack.
Os vik Attack.
Defeating Side Channels
Little Help From the Kernel
Chaining Modes.
Cipher Block Chaining.
Counter Mode
Choosing a Chain ng Mode
Putting It All Together.
Myths
xivContents
Providers.
FrequentlyAskedQuestions
Chapter 5Hash Functions.
Introduction.
Hash Digests Lengths
SHA-1 State, .
SHA-1 Expansion.
SHA-1 Compression
SHA-1 Implementation
SHA-256 State.
SHA-256 Expansion.
SHA-256 Compression
SHA-256 Implementation
SHA-512 State.
SHA-512 Expansion.
SHA-512 Compression
SHA-512 Implementation
One-Way ness.
Passwords.
Random Number Generators
Collision Resistance
File Manifests.
Intrusion Detection
Unsalted Passwords.
Hashes Make Bad Ciphers.
Hashes Are Not MACs.
Hashes Dont Double.
Purpose of A MAC Function
MACKey Lifespan:
Designs of SHS and Implementation
MD Strengthening,
SHA-1 Design
SHA-256 Design.
SHA-512 Design.
SHA-224 Design.
SHA-384 Design.
Zero-Copy ng Hashing
PKCS#5Key Derivation
Putting It All Together,
What Hashes Are For
What Hashes Are Not For.
Hashes Dont Mingle
Working with Passwords
Offline Passwords
Salts.r.
Salt Sizes
Rehash.
Online Passwords.
Two-Factor Authentication
Performance Considerations.
Inline Expansion.
Compression Unrolling.
Zero-Copy Hashing.
PKCS# 5 Example
FrequentlyAskedQuestions
Introduction.
Security Guidelines.
Cipher Message Authentication Code
Security of CMAC
CMAC Design.
Hash Message Authentication Code
Putting It All Together.
Chapter 6 Message-Authentication Code Algorithms 251
Standards.254
CMAC Initialization.
CMAC Processing+
CMAC Implementation
CMAC Performance.
HMAC Design.
HMAC Implementation
What MAC Functions Are For?.
Consequences, .
What MAC Functions Are Not For?
CMAC versus HMAC,
Replay Protection
Timestamps.
Counters.
Encrypt then MAC?
Encrypt then MAC.
MAC then Encrypt.
Encryption and Authentication
FrequentlyAskedQuestions.
Introduction.
Encrypt and Authenticate Modes
Security Goals.
Standards.
Design and Implementation.
Additional Authentication Data
Design of GCM.
Chapter 7 Encrypt and Authenticate Modes.
GC MGF(2) Mathematics.
Universal Hashing.
GCM Definitions
Implementation of GCM, .
Interface.
GCM Generic Multiplication
GCM Optimized Multiplication
GCM Initialization.
GCM IV Processing.
GCM A AD Processing.
GCM Plaintext Processing
Terminating the GCM State
GCM Optimizations.
Use of SIMD Instructions.
Design of CCM
CCMB, Generation.
CCM MAC Tag Generation
CCM Encryption.
CCM Implementation,
Putting It All Together.
What Are These Modes For?.
Chapter 8 Large Integer Arithmetic.
.339
xvii
Choosing aN once.
GCM Nonces
CCM Nonces
Further Resources
Multiplication Macros
Code Unrolling.
Squaring Macros,
Additional Authentication Data
MAC Tag Data.
Example Construction, .
FrequentlyAskedQuestions
Introduction.
What Are Big Nums?
Key Algori