21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

obtained the public key of the server, it will need to request those credentials, generally<br />

over an insecure channel (e.g., over the Internet). What is to stop an attacker<br />

from replacing the server’s credentials with its own credentials?<br />

Then, when the client tries to establish a secure connection, it could actually be talking<br />

to an attacker, who may choose to either masquerade as the server or just sit in<br />

the middle, communicating with the server on the client’s behalf, as shown in<br />

Figure 7-1 (B). Such an attack is known as a man-in-the-middle attack.<br />

A<br />

B<br />

Attacker<br />

Client Server<br />

Client<br />

Figure 7-1. A man-in-the-middle attack<br />

Getting a server’s key over an insecure channel is okay as long as there is some way<br />

of determining whether the key the client gets back is actually the right one. The<br />

most common way of establishing trust is by using a PKI, a concept we explain in<br />

Recipe 10.1.<br />

Another issue when it comes to public key cryptography is speed. Even the fastest<br />

public key cryptography that’s believed to be secure is orders of magnitude slower<br />

than traditional symmetric encryption. For example, a Pentium class machine may<br />

encrypt data using RC4 with 128-bit keys at about 11 cycles per byte (the key size<br />

isn’t actually a factor in RC4’s speed). The same machine can process data at only<br />

about 2,500 cycles per byte when using an optimized version of vanilla RSA and<br />

2,048-bit keys (the decrypt speed is the limiting factor—encryption is usually about<br />

20 times faster). True, versions of RSA based on elliptic curves can perform better,<br />

but they still don’t perform well for general-purpose use.<br />

310 | Chapter 7: Public Key Cryptography<br />

Request server credentials Request server credentials<br />

Send attacker credentials<br />

Actual traffic<br />

Perceived traffic<br />

Attacker<br />

Actual traffic<br />

Send server credentials<br />

This is the Title of the Book, eMatter Edition<br />

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.<br />

Server

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!