Download full IPSec the new security standart for the internet intranets and virtual private networks 2nd ed Edition Doraswamy ebook all chapters
Download full IPSec the new security standart for the internet intranets and virtual private networks 2nd ed Edition Doraswamy ebook all chapters
Download full IPSec the new security standart for the internet intranets and virtual private networks 2nd ed Edition Doraswamy ebook all chapters
https://ebookultra.com
https://ebookultra.com/download/ipsec-the-new-
security-standart-for-the-internet-intranets-and-
virtual-private-networks-2nd-ed-edition-doraswamy/
https://ebookultra.com/download/ipsec-the-new-security-standard-for-
the-internet-intranets-and-virtual-private-network-2nd-edition-
naganand-doraswamy/
ebookultra.com
https://ebookultra.com/download/cisco-secure-virtual-private-networks-
csvpn-ccsp-self-study-2nd-ed-edition-andrew-g-mason/
ebookultra.com
https://ebookultra.com/download/private-security-and-the-
investigative-process-third-edition-charles-p-nemeth/
ebookultra.com
https://ebookultra.com/download/the-genealogist-s-internet-2nd-
expanded-ed-edition-peter-christian/
ebookultra.com
https://ebookultra.com/download/building-a-virtual-private-
network-1st-edition-meeta-gupta/
ebookultra.com
https://ebookultra.com/download/local-networks-and-the-internet-from-
protocols-to-interconnection-1st-edition-laurent-toutain/
ebookultra.com
https://ebookultra.com/download/vsat-networks-2nd-ed-edition-maral/
ebookultra.com
https://ebookultra.com/download/security-for-wireless-ad-hoc-
networks-1st-edition-farooq-anjum/
ebookultra.com
IPSec the new security standart for the internet intranets
and virtual private networks 2nd ed Edition Doraswamy
Digital Instant Download
Author(s): Doraswamy, Naganand; Harkins, Dan
ISBN(s): 9780130461896, 013046189X
Edition: 2nd ed
File Details: PDF, 1.90 MB
Year: 2003
Language: english
IPSec
The New Security
Standard for the Internet,
Intranets, and Virtual
Private Networks
Second Edition
ISBN 013046189-X
94499
9 780130 461896
This page intentionally left blank
IPSec
The New Security Standard
for the Internet, Intranets, and
Virtual Private Networks
Second Edition
Naganand Doraswamy
Dan Harkins
Prentice Hall books are widely used by corporations and government agencies for training,
marketing, and resale.
The publisher offers discounts on this book when ordered in bulk quantities. For more information,
contact Corporate Sales Department, phone: 800-382-3419; fax: 201-236-7141; email: [email protected]
Or write Corporate Sales Department, Prentice Hall PTR, One Lake Street, Upper Saddle River, NJ 07458.
Product and company names mentioned herein are the trademarks or registered trademarks
of their respective owners.
10 9 8 7 6 5 4 3 2 1
ISBN 0-13-046189-X
Table of Contents
Preface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . xi
Internet Security. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
Crypto Concepts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
More Information. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
vii
viii IPSec
Addressing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29
IPSec Implementation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
IPSec Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 66
Security Associations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 71
IPSec Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 77
Fragmentation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ICMP. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 80
ESP Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 86
ESP Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 88
Table of Contents ix
AH Modes . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 96
AH Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 97
IKE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 112
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 129
8 Policy . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 131
Policy Definition Requirement . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 133
Deployment . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 139
11 Deployment Scenarios
(Using IPsec to Secure the Network) . . . . . . . . . . . . . . . . . . .177
Site-to-Site Policies . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Summary . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 215
Multicast . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
L2TP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 237
Bibliography . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .247
Index . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .253
Chapter
Preface
xi
xii IPSec
Organization
This book is split into three parts: overview, detailed analysis, and
implementation and deployment issues.
Part One is composed of the first three chapters. Chapter 1 dis-
cusses the basic cryptographic building blocks upon which IPSec is
built. Symmetric and public-key cryptography and their use for both
encryption and authentication are explained. Chapter 2 discusses the
Preface xiii
Chapter
CHAPTER
Cryptographic
History and
Techniques
1
2 IPSec
Secrets in History
In antiquity it was easier to keep a secret because the ability to read
was a privilege known to a select few. The number of people who could
read a written secret was very limited. Merely by restricting access to the
written word, a secret could be retained. The security of such a scheme is
obviously limited.
As the ability to read became more prevalent the need to keep secrets
from those with the ability to read became more necessary. This need
manifested itself most notably in war. While those doing the actual fight-
ing were most likely illiterate, the ones who waged the war were not and
each side, no doubt, employed soldiers who could read and speak the lan-
guage of their enemies. Military communications in the battlefield were
probably the genesis of cryptography.
Early attempts at cryptography were simplistic. It is rumored that
Caesar used a rudimentary cipher to obfuscate his messages. Those with
whom he wished to share a secret were told how to reconstruct the origi-
nal message. This cipher, The Caesar Cipher, was a simple substitution
cipher: Every letter in the alphabet was replaced by the letter three places
away modulus the length of the alphabet. In other words, the letter A
became D, B became E, X became A, Y became B, Z became C, etc. It’s a
simple cipher to decode but li brx grq’w nqrz krz lw’v qrw reylrxv!—in
other words, if you don’t know how it’s not obvious! Another variant of
this is the ROT-13 cipher. Each letter is rotated 13 places.
Simple substitution ciphers are not very good since each occurrence
of a letter is replaced by the same letter. Analysis of a language will result
in the probability of letters following other letters—notice the occurrence
of the letter r in the above “ciphertext.” It’s probably a vowel—and this
information can be used to determine the substitution offset.
Confidentiality was not the only concern in antiquity. Authentica-
tion was another. When few could write, a signature would probably suf-
fice. As the knowledge of reading and writing became more prevalent,
wax seals bearing the unique mark of the “signer” were used to authenti-
cate letters, documents, and edicts. The rise of industry brought the capa-
bility to make such a seal to more people and the seal ceased being
unique. In effect, it became trivial to forge a seal.
Jumping to modern times, ciphers, and their cryptanalysis, have a
very notable place in history. Prior to the United States’ involvement in
World War II, the United States Army was able to crack a code used by
the Japanese government. This capability allowed the United States to be
1 Cryptographic History and Techniques 3
forewarned about the attack on Pearl Harbor. This knowledge was not
put to good use, though, and the United States suffered great losses as a
result of this “surprise” attack. During the same war the German govern-
ment used an encryption device called Enigma to encipher its communi-
cations. This device used a set of rotors (Enigma machines had 5 but only
3 were used for any given communication) that contained the letters of
the alphabet and could be independently set. Each letter of input text was
transformed into a seemingly random character of output. Seemingly
random, because the permutations of transposition were astronomical.
The cracking of the Enigma machine was an incredible feat started by the
Polish and finished by the British and the story behind the cryptanalysis
of Enigma is large enough to be its own book. In fact, several books have
been written on the subject.
Communication technology has grown steadily from the days of Cae-
sar to modern times. From papyrus paper to telegram, telex, telephone,
FAX, and e-mail, the ability to communicate has been made easier and
more ubiquitous. At the same time, the ability to keep such communica-
tions secret has remained something of a black art known only to a few—
generally governments and military organizations.
The security of each method of communication is dependent on the
medium over which the communication is made. The more open the
medium the greater the possibility of the message falling into the hands
of those for whom it was not intended. Modern day methods of commu-
nication are open and public. A telephone call or FAX transmission goes
across a shared, public, circuit-switched phone network. An e-mail is
transmitted across a shared, public, packet-switched network. An entity
in the network between communications endpoints could easily intercept
the message. Retention of a secret transmitted using modern methods of
communication requires some sort of cryptographic technique to prevent
any of these eavesdroppers from learning the secret.
At its base modern cryptography relies on a secret known by the
intended recipient(s) of the message. Typically the method of encipher-
ment, the algorithm, is known but the “key” to unlock the secret is not.
There are certain cryptosystems that are based upon a secret algorithm—
so-called “security through obscurity”—but typically people are reluctant
to use an algorithm which is not open to public scrutiny (the debate over
the Clipper Chip is a prime example of this).
The problem, then, is to ensure the secrecy of the key—that it is
obtainable only by those to whom it should be known. Modern cryptog-
raphy provides for this.
4 IPSec
Internet Security
The Internet is an ethereal thing. It can appear quite different when
looked at for different purposes. For the purposes of secret-sharing, imag-
ine the Internet as a huge town hall which is packed with people.
Attempting to communicate a secret in such an environment is difficult,
and the chance of others overhearing a conversation between two people
increases as the distance between those two people increases. Since the
Internet is truly global, no secret of any value can be communicated on it
without the help of cryptography.
As the Internet grows (almost exponentially in recent years), its utility
increases. Messages can be sent cheaply and reliably and communication
is the lifeblood of business. For a company to engage in electronic com-
merce—the sale of goods and services over the Internet—security is a
must. Sensitive information such as credit card numbers must be pro-
tected and a business must be able to authenticate each and every sale. In
addition, businesses can use the Internet to inexpensively connect dispar-
ate offices. Interoffice electronic mail and even phone calls can be routed
over the Internet. Because sensitive corporate information would most
likely be transmitted over these links, the need for security should be
obvious.
But, Internet security concerns are not solely business’. Each and
every person has a need and a right to privacy, and when someone goes
on-line, the expectation of privacy does not disappear. As consumer elec-
tronics become more and more Internet-aware, the need for security
grows. When our phones and VCRs become accessible over the Internet,
we won’t want pranksters or hackers to steal our phone line or randomly
turn our VCRs on and off.
Privacy is not just confidentiality, though; it also includes anonymity.
People must be comfortable in cyberspace and an often ignored compo-
nent of that is the ability for an individual to remain anonymous. What
we read, where we go, to whom we talk, for whom we vote, and what we
buy is not information that most people traditionally publicize, and if
people are required to disclose information in cyberspace that they would
not normally disclose in real life, they will be reluctant to engage in Inter-
net activity.
Thankfully, cryptography can address these concerns.
6 IPSec
gx = y mod p
Selected
leaf
Trunk
plaintext = Decrypt(Encrypt(plaintext))
Symmetric Ciphers
Symmetric ciphers use a single key to do both encryption and
decryption. There are two types of symmetric ciphers, block ciphers and
stream ciphers. Block ciphers, such as AES, CAST, and Blowfish, operate
on data one block at a time, with the size of the block depending on the
algorithm (AES has a 128-bit block size while both CAST and Blowfish
have a 64-bit block size). Each block operation is treated as an atomic act.
Stream ciphers, such as RC4, on the other hand operate on data one bit
(or one byte) at a time. Appropriately seeded with a key, they will pro-
duce a stream of bits which can be XORed with the input. The encryptor
and the decryptor must be syncronized to ensure that the same bit in the
stream used to encrypt a particular bit of plaintext is also used to decrypt
the corresponding bit of ciphertext. If the two ever get out of syncroniza-
tion the plaintext will not be able to be recovered. It is this syncronization
problem that makes stream ciphers inappropriate for use with IPSec. If a
packet is dropped using a block cipher that will not affect the processing
of subsequent packets, but if a packet is dropped using a stream cipher all
10 IPSec
Plaintext
IV
Encryption E E E E
Ciphertext
CBC encryption
Ciphertext
Decryption D D D D
IV
Plaintext
CBC decryption
Other popular modes are Cipher Feedback Mode (CFB), where the
previous ciphertext block is encrypted and XORed with the current
plaintext block (the first block of plaintext is merely XORed with the IV),
and Output Feedback Mode (OFB), which maintains a cipher state that
is repeatedly encrypted and XORed with blocks of plaintext to produce
ciphertext (an IV represents the initial cipher state).
Asymmetric Ciphers
Asymmetric algorithms are also known as public key algorithms.
There are two keys, one public and one private. One key does the encryp-
tion, the other the decryption, and given a public key it is computation-
ally impossible to determine the private key (as defined above, we can say
that good public key algorithms are computationally secure). Good public
key algorithms are based on one-way functions.
12 IPSec
RSA The most popular public key algorithm is RSA, named after its
inventors Ron Rivest, Adi Shamir, and Leonard Adleman. The security of
RSA is based on the difficulty in factoring the product of two very large
prime numbers. This is a one-way function: it is easy to compute the
product of two large prime numbers but extremely difficult to factor the
product into the original prime numbers. One of the features of RSA is
that either key can be used to encrypt data that the other key can decrypt.
This means that anyone can encrypt a message in your public key that
you alone can decrypt. Also, you can encrypt anything with your private
key that anyone with your public key can decrypt. You’re probably think-
ing, what’s the point then? But this concept is very important in non-
repudiation and digital signatures (which will be discussed shortly).
A drawback of RSA is that it is quite slow and can operate only on
data up to the size of the modulus of its key. A 1024-bit RSA public key
can only encrypt data that is less than or equal to that size (actually, it’s
1013 bits because the definition on how to encrypt using RSA requires an
encoding that consumes 11 bits). While this is a restriction similar to a
symmetric block cipher, the speed of RSA makes it unsuitable for bulk
data encryption. This does not mean that RSA is not useful. On the con-
trary, it is a de facto standard for such important techniques as key
exchange and digital signature.
1 Cryptographic History and Techniques 13
Authentication
Public key cryptography can be used for authentication purposes by
constructing a so-called digital signature which has properties similar to a
traditional signature. A traditional handwritten signature is difficult to
forge, and is therefore difficult to repudiate. But because a handwritten
signature is just more writing on a document, it is possible (although also
difficult given a well-written document) for unscrupulous people to add
additional text to an already signed document, giving the impression that
the signer agrees to or acknowledges that text.
The Internet is a largely anonymous place and digital information
can live a long time, so there are other properties we need for digital sig-
natures in addition to those that a traditional handwritten signature
affords.
A digital signature must be difficult to forge and therefore difficult to
repudiate, just like a traditional signature. In addition, it must convey
message integrity and must be unique. We want to prevent additional
text from being added to a digitally signed file and we also want to pre-
vent a signature from being removed from an authentic, signed document
and added to other documents. These properties can all be met using
public key cryptography.
It is easiest to envision digital signature as encryption and verification
of a digital signature as decryption. In fact, that is the way an RSA signa-
ture works. But another public key algorithm, in fact a standard for digi-
tal signatures, aptly named the Digital Signature Standard (DSS), does
14 IPSec
not operate in that manner. The difference will be explained shortly, but
for purposes of illustration it is encryption and decryption.
What the private key encrypts the public key decrypts. Provided the
private key from a public/private key cryptosystem is kept secret, it can be
used to construct digital signatures. By encrypting a document with a pri-
vate key, anybody in possession of the corresponding public key can
decrypt the document. Of course an encrypted document is hardly a sig-
nature and verification would just entail reconstruction of something that
looks good out of the encrypted gibberish. It would also require decryp-
tion, and implicit signature verification, every time the document merely
needs to be read.
A digital signature is therefore not a private-key encryption of the
entire document. Digital signature techniques use one-way hash func-
tions to reduce a document down to a digest. It is that digest that is
encrypted. Remember that a hash function will produce the same digest
every time it is given identical input and that the input can be of arbitrary
length. Provided the hash function has strong collision-resistant proper-
ties, we can be assured that the signature is unique to the document.
The encrypted digest, the digital signature, can then be appended to
an original document. Verification of the signature entails running the
original document through the identical hash function to product a tem-
porary digest and decrypting the signature to recover the original digest.
If the two digests are equal, the signature is valid. This technique has all
the properties we need:
1. difficult to forge: only the holder of the private key can generate
the signature.
2. nonrepudiable: a signed document cannot be repudiated later
due to extreme difficulty in forging.
3. unalterable: once signed, a document cannot be modified.
4. nontransferable: the signature cannot be removed and attached
to another document.
It is also possible to have multiple signatures, produced from differ-
ent private keys, on a single document. Each signature is generated in the
same fashion by encrypting a digest of the document to be signed. These
encrypted digests are merely appended, one after the other, on the end of
the document.
1 Cryptographic History and Techniques 15
RSA Due to its unique nature—what one key encrypts the other
decrypts—RSA is well suited for digital signatures as well as for encryp-
tion. You just use a different key to do the encryption! The technique
described previously is exactly what happens when using RSA with digital
signatures.
There are no requirements to use any particular hash algorithm when
using RSA signatures.
Message Integrity
A digital signature provides integrity on the signed document. Any
modification to the document would be detected by checking the signa-
ture. One drawback of digital signatures is that they are slow and another
is that the entire message must be known prior to signature generation.
There is no efficient way to provide message integrity of an ongoing data
stream using digital signatures.
Just as there are symmetric and asymmetric ciphers, there are sym-
metric and asymmetric methods of guaranteeing message integrity. Simi-
lar to symmetric ciphers, where one single key is used for both encryption
and decryption, symmetric message authentication codes (MACs) use a
single key for generating and verifying the authentication information.
(MACs are sometimes erroneously referred to as signatures—they’re not.)
Hash functions are used as MACs just as they are in digital signatures.
Since the input to a hash function can be of any length, all one needs to do
to generate a MAC is hash a shared secret key along with the message. The
16 IPSec
Where the ipad is a 64-element array of the value 0x36 and the opad is a
64-element array of the value 0x5c.
All message authentication done in IPSec uses HMACs.
Key Exchanges
Symmetric ciphers and symmetric MACs both require a shared key.
The security of the encryption and authentication techniques could be
completely undermined by an insecure key exchange.
1 Cryptographic History and Techniques 17
Diffie-Hellman
The Diffie-Hellman key exchange is the first public key cryptosystem
and was the one described in the aforementioned paper “New Directions
in Cryptography” by Whitfield Diffie and Martin Hellman. The Diffie-
Hellman key exchange is based on the Discrete Logarithm Problem
(notice how often this one-way function is used).
This key exchange is extremely important. Using the Diffie-Hellman
exchange, a nonsecret, untrusted communications channel (like the
Internet) can be used to securely establish a shared secret among the par-
ties of the exchange. It is because of the Diffie-Hellman key exchange that
symmetric ciphers and symmetric message integrity schemes (which both
require a shared key) can be used in a scalable manner.
The usual players in describing modern cryptography are Alice and
Bob and they can be used to illustrate the Diffie-Hellman exchange. All
participants in a Diffie-Hellman exchange must first agree on a group that
defines which prime, p, and generator, g, will be used. A Diffie-Hellman
exchange is two-part. In the first part each side, Alice and Bob, choose a
random private number (indicated by the lowercase initial of the party)
and exponentiate in the group to produce a public value (uppercase ini-
tial of the party):
Alice Bob
A= ga mod p B = gb mod p
They exchange their public values, Alice gives A to Bob and Bob gives B
to Alice, and they exponentiate again, using the other party’s public value
as the generator, to generate shared secret.
Alice Bob
Crypto Concepts
Using the tools described above, it’s possible to build a very compli-
cated and very extensible system for network security. IPSec is an exam-
ple. IPSec uses symmetric ciphers in CBC mode for encryption and
HMACs for bulk data authentication. The Internet Key Exchange is basi-
cally an authenticated Diffie-Hellman exchange. One method of authen-
tication is digital signatures, another involves HMACing a shared secret,
a third involves public key encryption to authenticate a peer.
There are certain concepts that are important to IPSec that are not
necessarily cryptographic tools.
Perfect Forward Secrecy
Symmetric keys have a much shorter lifetime than asymmetric. This
is due to the complexity of the algorithms. Asymmetric algorithms are
based on one-way functions, symmetric algorithms are not. While both
are in the same class of complexity, asymmetric algorithms are necessarily
the most difficult to solve of that class. They may be as difficult to solve as
symmetric algorithms (it’s the complexity theorists debate of whether NP
is equal to NP-complete) but are believed to be more difficult. Until some-
one proves that these two types of algorithms are of equal complexity we
continue to believe that asymmetric algorithms are more complex than
symmetric ones. This is a long way of explaining that certain keys have to
be thrown away, and never used again, much sooner than other keys.
When a Diffie-Hellman exchange is used to generate a symmetric key
(the kind of key that must be changed more frequently), both parties
contribute to the result. The key is ephemeral. If that key is thrown away
and replaced by a new key, which is the result of another Diffie-Hellman
exchange, the two keys will have no relationship to each other. If an
attacker broke a single symmetric key, he would have access to all data
that was protected by that key but not to data protected by any other key.
In other words, the system that uses such ephemeral, single-use, keys has
perfect forward secrecy.
A system would not have perfect forward secrecy if there was a single
secret from which all symmetric keys were derived. In that case, breaking
the root key could give an attacker all keys derived from that root and
therefore all data protected by all those keys.
The important issue to keep in mind regarding perfect forward
secrecy is that it is not enough to just use a different key, the keys must be
unique.
20 IPSec
Perfect forward secrecy is important for some applications but not for
all. There is a definite overhead associated with doing a Diffie-Hellman
exchange at each rekey interval. If the data requires such security it is an
appropriate price to pay, but if it doesn’t, it could be excessive. So, perfect
forward secrecy may not be necessary every single time. The IPSec stan-
dard key exchange, IKE, therefore has an option for perfect forward
secrecy. If the parties desire it, it is possible, but not necessary.
Denial of Service
Cryptography is not free. Doing modular exponentiation or comput-
ing the product of two very large prime numbers, even decrypting and
verifying the integrity of individual packets, takes both wall clock time
and CPU time. If it was possible to force a computer to do unnecessary
work while trying to achieve security, it might be possible to shut down
that computer. Such an attack is called a denial of service attack.
Denial of service attacks can be launched against cryptographic sys-
tems if the system can be induced to do unnecessary work or allocate
memory unnecessarily. A denial of service attack is when the attacker can
cause the attackee to do more work in response to the attack than is nec-
essary to launch the attack.
An example of such an attack would be if Alice was willing to do a
Diffie-Hellman exchange and Mallory sent thousands of bogus Diffie-
Hellman public values to her, all with fake return addresses. Alice could
be forced to do her part for these fake exchanges. That could be quite a
bit of work! It would be almost no work for Mallory, though, because it’s
computationally effortless to generate a string of random bits that look
like a Diffie-Hellman public value. It’s much more work to actually expo-
nentiate and generate a real one.
Another denial of service attack can be launched if Alice and Bob
share symmetric keys which they use to encrypt and authenticate individ-
ual IP packets. Mallory could send thousands of packets to Bob that look
like they came from Alice. Since Mallory doesn’t share the key the packets
would be bogus, but the only way Bob could find that out is to do the
work of decrypting and verifying the integrity of the packet! It’s much
cheaper to generate bogus packets than it is to detect that they’re bogus.
Thankfully, IPSec and IKE are constructed with partial defenses
against denial of service attacks. These defenses do not defeat all denial of
service attacks, but merely increase the cost and complexity to launch
them.
1 Cryptographic History and Techniques 21
More Information
This chapter provides a brief overview of some cryptographic con-
cepts that will be expanded on later in this book. Cryptography is a com-
plex art, though, and it cannot be adequately explained in a short chapter
like this. There are many good books that give a solid background in
cryptography that you’re strongly encouraged to read. A good place to
start is Cryptography and Data Security by Dorothy Denning, and Applied
Cryptography by Bruce Schneier.
There are important and fascinating protocols and problems that
were not covered here. For instance, the zero knowledge proof: where one
party proves to another that she knows some information without actu-
ally divulging the information. Another one-way function that was not
discussed is the knapsack problem. Like the discrete logarithm problem,
the knapsack problem can be used to construct public key cryptosystems.
Other, more complicated, key exchanges also exist, like the Encrypted
Key Exchange (EKE). There are even attacks against the cryptographic
tools that IPSec uses, like the Birthday Attacks against hash functions.
This attack takes its name from the observation that if you are in a room
with only 182 other people, the chances are even that one of those per-
sons has the same birthday as you. If there is a room of only 23 people,
the chances are even that there are two people in the room that share the
same birthday. This in spite of the fact that there are 365 (sometimes
366) days in the year! The birthday paradox affects hashing algorithms
because it illustrates the statistical probability of finding two random
inputs that will hash to the same digest—i.e., in finding a collision. If the
digest from a hash algorithm is n bits in length, finding two distinct mes-
sages that hash to the same digest would take O(2n/2) operations.
Cryptography is probably as old as speech but it continually evolves
to solve new, interesting, and critically important problems of today and
tomorrow.
This page intentionally left blank
Chapter
CHAPTER
TCP/IP Overview
1. For a more in-depth discussion of TCP/IP protocol, we strongly recommend that readers refer to
other books.
23
24 IPSec
Introduction to TCP/IP
In this section, we briefly discuss the protocols used in the TCP/IP
stack, the addressing architecture, the Domain Name System (DNS), and
the socket interface.
In the early 1960s, DARPA (Defense Advanced Research Project
Agency) funded a project that connected universities and research agen-
cies through a network called ARPANET. In 1983, the TCP/IP protocols
replaced the original ARPANET NCP (Network Control Protocols). The
TCP/IP protocols running this network were open, simple, and easy to
use. This network has grown considerably into what is called “Internet.”
The Internet is a collection of networks running TCP/IP protocol suite.
In the ’80s there were other networking protocol architectures—
ISOs OSI, IBMs SNA, and Digital’s DECNET to name a few. However,
none of these protocols were as simple and open as the TCP/IP protocol
suite. This led to wide deployment, development, and support for the
TCP/IP protocol suite.
The networking protocol architecture consists of various components:
• Protocol stack—This comprises various layers that communicate
among themselves to efficiently transmit the packet.2
• Addressing—The capability to uniquely identify a destination. In
order to communicate with a global entity, it is necessary to
uniquely identify the entity.
• Routing—The capability to efficiently determine the path a par-
ticular packet is to traverse to reach a destination.
Protocol Stack
The TCP/IP protocol stack consists of 4 layers as shown in Figure 2.1.
Each layer in the stack has well-defined functions and capabilities. Each
layer exports well-defined interfaces that the layers above and below it can
use to communicate with it. The layered architecture has many advantages.
In addition to simplifying the design of the protocol stack, it also simplifies
its usage. The design is simplified as each layer interacts only with the layer
immediately above and below it. Once the service the layer provides and its
interfaces are identified, each layer can be designed independently. The
usage is simplified as the complexities of the networking stack are hidden
from the applications using the networking stack.
2. Packet is the unit of data.
2 TCP/IP Overview 25
Application Layer
Transport Layer
Network Layer
3. In this book we use the term “host” in the context of an end system. The host generates traffic but is not involved in
any routing decisions. Routers, on the other hand, normally do not generate traffic but instead forward traffic. The
term “gateways” normally refers to a router.
2 TCP/IP Overview 27
Data Flow
The data flow from source to destination is as shown in Figure 2.3.
For the purposes of the discussion, let us assume that the transport
protocol is TCP and the network protocol is IP.
3. The network layer receives the payload from the transport layer.
This consists of the data and the TCP header. It appends an IP
header to this payload. It then sends the payload plus IP header
down to the data link layer. In addition, the network layer also
identifies the neighbor the packet needs to be sent to en route to
the destination.
4. The data link layer then appends a data link header to the pay-
load from the network layer. The data link layer identifies the
physical address of the next hop the packet should be sent to and
sends the packet.
5. The data link layer on the next hop receives the packet, strips the
data link header from the packet and sends the packet up to the
network layer.
6. The network layer looks at the network header and decides the
next hop the packet needs to be sent to en route to the destina-
tion and invokes the data link layer.
7. The data link layer appends the data link header to the payload
and transmits the packet to the next hop.
8. Procedures 6 and 7 are repeated till the packet reaches the desti-
nation.
9. Upon reaching the destination, the data link layer strips the data
link header from the packet and sends it up to the network layer.
10. The network layer then strips the network header from the
packet and sends it up to the transport layer.
11. The transport layer then checks the transport header to guarantee
that the application is being serviced properly, strips the transport
header, identifies the application to which this packet is destined,
and sends it up to the application.
12. The application on the destination receives the data that was sent
to it by the application on the source.
Network Layer
In the TCP/IP protocol suite, there are two network protocols—IPv4
and IPv6. These protocols are discussed to an extent that provides good
context to understand IP Security.
IPv4
IPv4 (Internet Protocol version 4) is the most prevalent network layer
protocol today. It uses a simple addressing scheme and provides connec-
tionless service. IPv4 has a very mature routing infrastructure.
2 TCP/IP Overview 29
Addressing
Addressing is one of the important components of a network layer
protocol. IPv4 identifies each host4 by a 32-bit address. This address is
normally represented in the form A.B.C.D. This notation is commonly
referred to as dotted decimal notation where each symbol is a byte (8
bits). An example of an IPv4 address is 128.127.126.125. This represen-
tation is chosen instead of a flat number space because it imparts hierar-
chy to addressing and also is easier to perceive.
An IP address has two parts—a network ID and a host ID. The net-
work ID logically groups a set of IP addresses together. The grouping is
required to provide efficient routing and other services, such as IP broad-
cast.5 The network ID part of an IP address is obtained by logical AND
of the IP address with the network mask. The network mask is always a
contiguous bit of 1s. Examples of network masks are 255.255.255.0,
255.255.0.0, and 255.254.0.0. In these examples the leftmost (starting
from the most significant bit) 24, 16, and 15 bits are 1’s respectively. The
network ID for the IP address 128.127.126.125 with the example net-
work masks is 128.127.126, 128.127, and 128.126 respectively. This is
obtained by logical AND of the network masks with the IP address as
shown in Figure 2.4. An IP address is always represented along with its
network mask.There are two representations: 128.127.126.125/
255.255.255.0 or 128.127.126.125/24. Both representations have the
same meaning, i.e., the network ID are 24 most-significant bits of the IP
address.
"Sana vain, rakas Kristiina! Jos näet kreivi Oton, ja sopivasti voit
lausua hänelle pari sanaa, niin pyydä häntä olemaan varuillaan, sillä
täällä on hänen verivihollisensa, se maanpakolaispappi, jonka hän
ruoskitti ulos kuninkaan kartanosta! Minä itse olen nähnyt hänet,
varmasti hän on väijymässä, saadakseen salaisesti kostaa."
"No, mikä sinun on, sisar? Sinulla ei ole mitään pelättävää. Pyydä
vain kreivi Ottoa olemaan varuillaan ja pitämään joka hetki ase
mukanaan! Mutta sano hänelle se siten, ettei sitä kukaan selitä
pahoin. Elä katso liian lempeästi häneen tai kehenkään muuhun
ylhäiseen herraan. Ah, rakas sisar! Muista, että isämme oli köyhä
ritari, sekä että pyhä, tahraton nimi on ainoa perintömme ja
omaisuutemme!"
"Kyllin tästä, rakas sisar! Elä vain unhoita, mitä sanoin sinulle!"
"Siitä hän ei mitään puhunut, jalo herra! Mutta olkaa nyt todella
varovainen! Minä olen niin peloissani sen petturipapin takia."
"Mikä tuon hyvän, sievän lapsen on? Ei kai hän sentään noin
pelkää minun läsnäoloani?"
Ovela pappi oli pian huomannut, että Kaarlo oli hänet tuntenut
Kissanpään-ovella, kun hänen Ottoon heittämänsä kostonhimoinen
katse oli ilmiantanut hänet. Siksi hän oli viisaasti lykännyt
mieskohtaisen kostonsa parempaan tilaisuuteen ja kiiruhti
suorittamaan tärkeämpää konnantekoa, minkä onnellisesta
päättymisestä riippui koko hänen menestymisensä Schwerinin
kreivien luona. Nuo tärkeät paperit kainalossaan ja hiottu tikari
viittansa alla hän oli palatessaan kuninkaan salakammiosta
piiloittautunut linnan hämäriin käytäviin, vartoakseen pimeään
saakka ja toivoen vielä tapaavansa Otto-kreivin. Mutta kun juhla niin
äkkiä keskeytyi, täytyi hänen lopulta pitää huolta turvallisuudestaan
ja nyt vasta, kun hän ratsasti eteläportin sillan yli, hän hengitti
vapaammin ja ratsasti hiukan hitaammin sen kappaleen joen
viereistä tietä, joka ulottui metsään saakka.
Kuningas tuli siitä itse pian vakuutetuksi. Hän kävi nyt usein
kuningattaren luona ja huomasi hänen päivä päivältä paranevan.
Hän iloitsi siitä sydämellisesti eikä lähtenyt Riiben linnasta. Mutta
tämä sairashuoneen hiljainen elämä ja ilma, johon hän ei ollut
tottunut, ikäänkuin ahdisti hänen elinvoimaista mieltään ja oli hänen
kiihkeätä luontoaan vastaan. Vielä enemmän sai hänet synkäksi se
ikävä tieto Roomasta, että pannanalainen piispa Valdemar, joka oli
nöyrtynyt paavin edessä, Otto-keisarin vaikutuksesta oli päässyt
vapaaksi pannanalaisuudesta, ja sen lisäksi vielä oli saanut oikeuden
pitää messuja piispanpukuun puettuna. Mutta sitten kerrottiin vielä,
että Saksenin herttua Bernhard oli keisarin tahdon mukaan, vaikka
vastoin paavin nimenomaista päätöstä, asettanut hänet uudelleen
Bremenin arkkipiispaksi. Vielä kerrottiin, että paavi oli kruunannut
keisari Oton vähän aikaa sitten, kun tämä oli nöyrtynyt pitämään
hänelle jalustinta. Näiden tietojen saapuessa Junkkeri Strange oli
kuninkaan huoneessa.
"Eikö hän laulanutkin sillä tavalla, pikku Kristiina —" nyt hän
kääntyi harhailevin katsein lääkäriin ja itki.
"Jos voit lukea, lapsi", sanoi Dagmar, "niin ota Raamattu ja lue
minun sieluni lepoon! Sittenkun minä olen kuollut ja haudattu, saat
sinä kantaa punaista purppuraa ja ratsastaa minun hevosellani!"
"Ah, jospa voisin vaan auttaa teitä, jalo kuningatar, jos voisin
pelastaa henkenne omallani — minä tekisin sen niin mielelläni." Hän
otti kirjan käteensä ja tuijotti siihen. "Ah, taivaan isä Jumala
auttakoon teitä, rakas Kristus armahtakoon teitä! Teidän tuskanne on
rautaa kovempi."
Pian Riisen Kaarle toi tuon surullisen uutisen. Hän oli itse niin
liikutettu, että hän vaivoin voi puhua. Kuningas nojautui parven
rauta-aitaan niin että se taipui. "Jumala estäköön hänet kuolemasta,
ennenkuin minä saavun!" sanoi hän rientäen hevosensa luo. Satojen
ritarien ja asemiesten kera hän lähti Skanderborgista. Kun hän
ratsasti Randbölin nummen yli, voi vain viisi miestä seurata häntä;
kun hän saapui Gristedin sillalle, seurasi häntä vain Riisen Kaarlo
vaivoin uupuneella juoksijallaan, ja kun hän ajoi Riiben sillan yli, hän
oli yksin.