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.

locations where 40-bit keys or 56-bit keys are used, because weak encryption used to<br />

be the maximum level of encryption that could be exported from the United States.<br />

Symmetric key length recommendations do not apply to public key<br />

lengths. See Recipe 7.3 for public key length recommendations.<br />

Supporting cryptographically weak configurations is a risky proposition. Not only<br />

are the people who are legitimately using those configurations at risk, but unless you<br />

are extremely careful in your protocol design, it is also possible that an attacker can<br />

force the negotiation of an insecure configuration by acting as a “man in the middle”<br />

during the initial phases of a connection, before full-fledged encryption begins. Such<br />

an attack is often known as a rollback attack, because the attacker forces the communicating<br />

parties to use a known insecure version of the protocol. (We discuss how to<br />

thwart such attacks in Recipe 10.7.)<br />

In the real world, people try very hard to get to 80 bits of effective security, which we<br />

feel is the minimum effective strength you should accept. Generally, 128 bits of effective<br />

security is considered probably enough for all time, if the best attack that can be<br />

launched against a system is brute force. However, even if using the right encryption<br />

mode, that still assumes no cryptographic weaknesses in the cipher whatsoever.<br />

In addition, depending on the way you use encryption, there are precomputation and<br />

collision attacks that allow the attacker to do better than brute force. The general<br />

rule of thumb is that the effective strength of a block cipher is actually half the key<br />

size, assuming the cipher has no known attacks that are better than brute force.<br />

However, if you use random data properly, you generally get a bit of security back<br />

for each bit of the data (assuming it’s truly random; see Recipe 11.1 for more discussion<br />

about this). The trick is using such data properly. In CBC mode, generally the<br />

initialization vector for each message sent should be random, and it will thwart these<br />

attacks. In most other modes, the initialization vector acts more like a nonce, where<br />

it must be different for each message but doesn’t have to be completely random. In<br />

such cases, you can select a random value at key setup time, then construct per-message<br />

initializers by combining the random value and a message counter.<br />

In any event, with a 128-bit key, we strongly recommend that you build a system<br />

without a 64-bit random value being used in some fashion to prevent against attack.<br />

Should you use key lengths greater than 128 bits, especially considering that so many<br />

algorithms provide for them? For example, AES allows for 128-bit, 192-bit, and 256bit<br />

keys. Longer key lengths provide more security, yet for AES they are less efficient<br />

(in most other variable key length ciphers, setup gets more expensive, but encryption<br />

does not). In several of our own benchmarks, 128-bit AES is generally only<br />

about 33% faster than 256-bit AES. Also, 256-bit AES runs at least 50% faster than<br />

Selecting an Appropriate Key Length | 161<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!