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.

11. The client and the server compute a master secret by concatenating the client<br />

secret and the server secret, then hashing that with SHA1, truncating the result<br />

to 128 bits.<br />

12. Both the client and the server generate derived keys for encryption and<br />

MAC’ing, as necessary.<br />

13. The client and the server communicate using their new agreed-upon keys.<br />

Incorporating either key transport or key exchange into a protocol that involves algorithm<br />

negotiation is more complex. In particular, after keys are finally agreed upon,<br />

the client must MAC all the messages received, then send that MAC to the server.<br />

The server must reconstruct the messages the client received and validate the MAC.<br />

The server must then MAC the messages it received (including the client’s MAC),<br />

and the client must validate that MAC.<br />

This MAC’ing is necessary to ensure that an attacker doesn’t maliciously modify<br />

negotiation messages before full encryption starts. For example, consider a protocol<br />

where the server tells the client which encryption algorithms it supports, and the client<br />

chooses one from the list that it also supports. An attacker might intercept the<br />

server’s list and instead send only the subset of algorithms the attacker knows how to<br />

break, forcing the client to select an insecure algorithm. Without the MAC’ing, neither<br />

side would detect the modification of the server’s message.<br />

The client’s public key is a weak point. If it gets stolen, other people can<br />

impersonate the user. You should generally use PKCS #5 to derive a<br />

key from a password (as shown in Recipe 4.10), then encrypt the public<br />

key (e.g., using AES in CWC mode, as discussed in Recipe 5.10).<br />

The SSL/TLS protocol handles all of the above concerns for you. It provides either<br />

one-way or two-way authenticating key exchange. (Note that in one-way, the server<br />

does not authenticate the client using public key cryptography, if at all.) It is usually<br />

much better to use that protocol than to create your own, particularly if you’re not<br />

going to hardcode a single set of algorithms.<br />

If you do not want to use a PKI, but would still like an easy off-the-shelf construction,<br />

combine PAX (Recipe 8.15) with the secure channel from Recipe 9.12.<br />

See Also<br />

Recipes 4.10, 5.10, 7.14, 8.15, 9.1, 9.2, 9.12<br />

Performing Authenticated Key Exchange Using RSA | 431<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!