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.

Because public key encryption is so expensive, it is only really useful for processing<br />

small pieces of data. As a result, there are two ways in which public key cryptography<br />

is widely used: key exchange (done by encrypting a symmetric encryption key) and digital<br />

signatures (done by encrypting a hash of the data to sign; see Recipes 7.12, 7.13<br />

and 7.15).<br />

When using digital signatures for authentication, a valid signature on a piece of data<br />

proves that the signer has the correct secret key that corresponds to the public key<br />

we have (of course, we then need to ensure that the public key really does belong to<br />

the entity we want to authenticate). The signature also validates that the message<br />

arrived without modification. However, it’s not a good idea to use digital signatures<br />

for all of our message integrity needs because it is incredibly slow. You essentially<br />

need public key cryptography to provide message integrity for a key exchange, and<br />

while you’re doing that, you might as well use it to authenticate (the authentication<br />

is often free). However, once you have a symmetric key to use, you should use MACs<br />

to provide message integrity because they’re far more efficient.<br />

The only time it makes sense to use a digital signature outside the context of initial<br />

connection establishment is when there is a need for non-repudiation. That is, if you<br />

wish to be able to demonstrate that a particular user “signed” a piece of data to a<br />

third party, you must use public key–based algorithms. Symmetric key integrity<br />

checks are not sufficient for implementing non-repudiation, because anyone who has<br />

the shared secret can create valid message integrity values. There’s no way to bind<br />

the output of the integrity check algorithm to a particular entity in the system. Public<br />

key cryptography allows you to demonstrate that someone who has the private<br />

key associated with a particular public key “signed” the data, and that the data<br />

hasn’t changed since it was signed.<br />

See Also<br />

Recipes 7.12, 7.13, 7.15, 10.1<br />

7.2 Selecting a Public Key Algorithm<br />

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

You want to determine which public key algorithms you should support in your<br />

application.<br />

Solution<br />

RSA is a good all-around solution. There is also nothing wrong with using Diffie-<br />

Hellman for key exchange and DSA for digital signatures.<br />

Selecting a Public Key Algorithm | 311<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!