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.

Discussion<br />

One-time pads are provably secure if implemented properly. Unfortunately, they are<br />

rarely used properly. A one-time pad is very much like a stream cipher. Encryption is<br />

simply XOR’ing the message with the keystream. The security comes from having<br />

every single bit of the keystream be truly random instead of merely cryptographically<br />

random. If portions of the keystream are reused, the security of data encrypted with<br />

those portions is incredibly weak.<br />

There are a number of big hurdles when using one-time pads:<br />

• It is very close to impossible to generate a truly random keystream in software.<br />

(See Chapter 11 for more information.)<br />

• The keystream must somehow be shared between client and server. Because<br />

there can be no algorithm to produce the keystream, some entity will need to<br />

produce the keystream and transmit it securely to both parties.<br />

• The keystream must be as long as the message. If you have a message that’s bigger<br />

than the keystream you have remaining, you can’t send the entire message.<br />

• Integrity checking is just as important with one-time pads as with any other<br />

encryption technique. As with the output of any stream cipher, if you modify a<br />

bit in the ciphertext generated by a one-time pad, the corresponding bit of the<br />

plaintext will flip. In addition, one-time pads have no built-in mechanism for<br />

detecting truncation or additive attacks. Message authentication in a provably<br />

secure manner essentially requires a keystream twice the data length.<br />

Basically, the secure deployment of one-time pads is almost always highly impractical.<br />

You are generally far better off using a good high-level interface to encryption<br />

and decryption, such as the one provided in Recipe 5.16.<br />

See Also<br />

Recipe 5.16<br />

5.25 Using Symmetric Encryption with<br />

Microsoft’s CryptoAPI<br />

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

You are developing an application that will run on Windows and make use of symmetric<br />

encryption. You want to use Microsoft’s CryptoAPI.<br />

Using Symmetric Encryption with Microsoft’s CryptoAPI | 237<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!