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.

In such a scenario, the sender has to have some way to ensure that it really does have<br />

the public key of the entity with which it wants to communicate. It can do this either<br />

by using a trusted third party (see Chapter 10) or by arranging to transport the public<br />

key in a secure manner, such as on a CD-R.<br />

If the recipient can send a message back to the sender using the session key, and that<br />

message decrypts correctly, the sender can be sure that an entity possessing the correct<br />

private key has received the session key. That is, the sender has authenticated<br />

the receiver, as long as the receiver’s public key is actually correct.<br />

Such a protocol can be modified so that both parties can authenticate each other. In<br />

such a scheme, the sender generates a secret key, then securely signs and encrypts the<br />

key.<br />

It is generally insecure to sign the unencrypted value and encrypt that,<br />

particularly in a public key–based system. In such a system, it is not<br />

even a good idea to sign encrypted values. There are several possible<br />

solutions to this issue, discussed in detail in Recipe 7.14. For now, we<br />

are assuming that you will be using one of the techniques in that recipe.<br />

Assuming that the recipient has some way to receive and validate the sender’s public<br />

key, the recipient can now validate the sender as well.<br />

The major limitation of key transport is that the machine initiating a connection may<br />

have a weak source of entropy, leading to an insecure connection. Instead, you could<br />

build a key agreement protocol, where each party sends the other a significant chunk<br />

of entropy and derives a shared secret from the information. For example, you might<br />

use the following protocol:<br />

1. The client picks a random 128-bit secret.<br />

2. The client uses a secure technique to sign the secret and encrypt it with the<br />

server’s public key. (See Recipe 7.14 for how to do this securely.)<br />

3. The client sends the signed, encrypted key to the server.<br />

4. The server decrypts the client’s secret.<br />

5. The server checks the client’s signature, and fails if the client isn’t authenticated.<br />

(The server must already have a valid public key for the client.)<br />

6. The server picks a random 128-bit secret.<br />

7. The server uses a secure technique to sign the secret and encrypt it with the client’s<br />

public key (again, see Recipe 7.14).<br />

8. The server sends its signed, encrypted secret to the client.<br />

9. The client decrypts the server’s secret.<br />

10. The client checks the server’s signature, and fails if the server isn’t authenticated.<br />

(The client must already have a valid public key for the server.)<br />

430 | Chapter 8: Authentication and Key Exchange<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!