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.

Solution<br />

There are essentially three classes of solutions:<br />

Insecure random number generators<br />

More properly, these are noncryptographic pseudo-random number generators.<br />

You should generally assume that an attacker could predict the output of such a<br />

generator.<br />

Cryptographic pseudo-random number generators (PRNGs)<br />

These take a single secure seed and produce as many unguessable random numbers<br />

from that seed as necessary. Such a solution should be secure for most uses<br />

as long as a few reasonable conditions are met (the most important being that<br />

they are securely seeded).<br />

Entropy harvesters<br />

These are sometimes “true” random number generators—although they really<br />

just try to gather entropy from other sources and present it directly. They are<br />

expected to be secure under most circumstances, but are generally incredibly<br />

slow to produce data.<br />

For general-purpose use, the second solution is excellent. Typically, you will need<br />

entropy (i.e., truly random data) to seed a cryptographic pseudo-random number<br />

generator and will not need it otherwise, except in a few specific circumstances, such<br />

as when generating long-term keys.<br />

You should generally avoid the first solution, as the second is worthwhile even when<br />

security is not an issue (particularly because we’ve seen numerous systems where<br />

people assumed that the security of their random numbers wasn’t an issue when it<br />

actually turned out to be).<br />

Entropy is highly useful in several situations. First, there’s the case of seeding a random<br />

number generator, where it is critical. Second, any time where you would like<br />

information-theoretic levels of security (i.e., absolutely provable secrecy, such as is<br />

theoretically possible with a one-time pad), then cryptographic randomness will not<br />

do. Third, there are situations where a PRNG cannot provide the security level<br />

required by a system. For example, if you want to use 256-bit keys throughout your<br />

system, you will need to have 256 bits of entropy on hand to make it a full-strength<br />

system. If you try to leverage an OS-level PRNG (e.g., /dev/random on Unix systems),<br />

you will not get the desired security level, because such generators currently<br />

never produce data with more than 160 bits of security (many have a 128-bit ceiling).<br />

In addition, a combination of the second and third class of solution is often a good<br />

practical compromise. For example, you might want to use entropy if it is available,<br />

but if it is not, fall back on a cryptographic solution. Alternatively, you might want to<br />

use a cryptographic solution that occasionally gets its seed changed to minimize the<br />

chance of a compromise of the internal state of the generator.<br />

Determining What Kind of Random Numbers to Use | 569<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!