21.03.2013 Views

Problem - Kevin Tafuro

Problem - Kevin Tafuro

Problem - Kevin Tafuro

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Discussion<br />

Be sure to read this discussion carefully, as well as other related discussions.<br />

While a strong encryption algorithm is a great foundation, there<br />

are many ways to use strong encryption primitives in an insecure way.<br />

There are two general types of ciphers:<br />

Block ciphers<br />

These work by encrypting a fixed-size chunk of data (a block). Data that isn’t<br />

aligned to the size of the block needs to be padded somehow. The same input<br />

always produces the same output.<br />

Stream ciphers<br />

These work by generating a stream of pseudo-random data, then using XOR * to<br />

combine the stream with the plaintext.<br />

There are many different ways of using block ciphers; these are called block cipher<br />

modes. Selecting a mode and using it properly is important to security. Many block<br />

cipher modes are designed to produce a result that acts just like a stream cipher.<br />

Each block cipher mode has its advantages and drawbacks. See Recipe 5.4 for information<br />

on selecting a mode.<br />

Stream ciphers generally are used as designed. You don’t hear people talking about<br />

stream cipher modes. This class of ciphers can be made to act as block ciphers, but<br />

that generally destroys their best property (their speed), so they are typically not used<br />

that way.<br />

We recommend the use of only those ciphers that have been studied by the cryptographic<br />

community and are held in wide regard.<br />

There are a large number of symmetric encryption algorithms. However, unless you<br />

need a particular algorithm for the sake of interoperability or standards, we recommend<br />

using one of a very small number of well-regarded algorithms. AES, the<br />

Advanced Encryption Standard, is a great general-purpose block cipher. It is among<br />

the fastest block ciphers, is extremely well studied, and is believed to provide a high<br />

level of security. It can also use key lengths up to 256 bits.<br />

AES has recently replaced Triple-DES (3DES), a variant of the original Data Encryption<br />

Standard (DES), as the block cipher of choice, partially because of its status as a<br />

U.S. government standard, and partially because of its widespread endorsement by<br />

leading cryptographers. However, Triple-DES is still considered a very secure alternative<br />

to AES. In fact, in some ways it is a more conservative solution, because it has<br />

been studied for many more years than has AES, and because AES is based on a rela-<br />

* Or some other in-group operation, such as modular addition.<br />

Figuring Out Which Encryption Algorithm Is Best | 157<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!