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.

The code presented in this chapter should otherwise translate easily to most other<br />

functionally complete libraries. Again, in situations where this is not the case, we<br />

expect that reader contributions will eventually mend this problem.<br />

We expect that for most purposes, the general-purpose networking<br />

recipes provided in Chapter 9 are likely to be more applicable to the<br />

average developer. Unless you really know what you’re doing, there is<br />

significant risk of needing a prosthetic foot when using this chapter.<br />

7.1 Determining When to Use Public Key<br />

Cryptography<br />

<strong>Problem</strong><br />

You want to know when to use public key cryptography as opposed to symmetric<br />

cryptography.<br />

Solution<br />

Use public key cryptography only for key exchange or digital signatures. Otherwise,<br />

there are a lot of disadvantages and things that can go wrong (particularly when<br />

using it for general-purpose encryption). Because public key operations are computationally<br />

expensive, limit digital signatures to authentication at connection time and<br />

when you need non-repudiation.<br />

Discussion<br />

Whenever you use public key encryption, be sure to remember also to<br />

perform proper authentication and message integrity checking.<br />

Public key cryptography allows parties to communicate securely without having to<br />

establish a key through a secure channel in advance of communication, as long as a<br />

trusted third party is involved. Therein lies the first rub. Generally, if you use public<br />

key cryptography, you need to determine explicitly with whom you’re communicating,<br />

and you need to check with a trusted third party in a secure manner. To do that,<br />

you will need to have identification data that is bound to your trusted third party,<br />

which you’ll probably need to authenticate over some secure channel.<br />

Figure 7-1 (A) illustrates why public key cryptography on its own does not provide<br />

secure communication. Suppose the server has a {public key, private key} pair, and<br />

the client wishes to communicate with the server. If the client hasn’t already securely<br />

Determining When to Use Public Key Cryptography | 309<br />

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

Copyright © 2007 O’Reilly & Associates, Inc. All rights reserved.

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

Saved successfully!

Ooh no, something went wrong!