views:

626

answers:

5

If I am using Rijndael CBC mode, I have no idea why we would need salt. My understanding is even if people know the password, but he cannot get the data without IV. So from my perspective, password + IV seem to be sufficent secure.

Do I get anything wrong?

A: 

The salt is there to stop dictionary attacks, and dictionary attacks only work against hashes (one-way encryption). Rijndael isn't a hashing algorithm, so I don't see how a salt is going to help.

Tom Dalling
A salt is used in the key derivation process. The PKCS #5 standard for key derivation, PBKDF2, uses a salt and an iteration count to derive a key from a password.
erickson
...and in this context, the salt indeed stops a dictionary attack - against the encryption password (the OP has left unstated that they're using password-based-encryption).
caf
A: 

A salt is generally used when using a hash algorithm. Rijndael is not a hash, but a two-way encryption algorithm. Ergo, a salt is not necessarily needed for encrypting the data. That being said, a salted hash of a password may be used as the Key for encrypting data. For what you're looking for, you might wish to look at hybrid cryptosystems.

The Key should be considered private and not transmitted with your encrypted data while the IV may be transmitted with the encrypted data.

Jesse C. Slicer
Negative. The IV is not considered confidential and, in fact, needs to be stored with the encrypted data, or else the data cannot be decrypted.
vy32
A: 

First things first: Rijndael does not have a "password" in CBC mode. Rijndael in CBC mode takes a buffer to encrypt or decrypt, a key, and an IV.

A "salt" is typically used for encrypting passwords. The salt is added to the password that is encrypted and stored with the encrypted value. This prevents someone from building a dictionary of how all passwords encrypt---you need to build a dictionary of how all passwords encrypt for all salts. That was actually possible with the old Unix password encryption algorithm, which only used a 12-bit salt. (It increased the work factor by 4096). With a 128-bit salt it is not possible.

Someone can still do a brute-force attack on a specific password, of course, provided that they can retrieve the encrypted password.

However, you have an IV, which does pretty much the same thing that a Salt does. You don't need both. Or, rather, the IV is your salt.

BTW, these days we call "Rijndael" AES.

vy32
IV and salt serve similar purposes: they ensure that otherwise identical inputs produce unpredictable outputs. However, a key derivation salt does not obviate the need for an IV. By choosing a new IV for each message, the same password can be used to encrypt many messages. Even if some of the messages are identical, an attacker won't be able to tell.
erickson
It seems that the OP is using password-based-encryption with Rijndael CBC (and Rijndael and AES are not precisely the same thing - AES is effectively a subset of Rijndael; the former has a fixed 128 bit blocksize whereas the latter has a variable blocksize).
caf
+6  A: 

Yes, you need all of these things.

Salt (and an "iteration count") is used to derive a key from the password. Refer to PKCS #5 for more information. The salt and iteration count used for key derivation do not have to be secret. The salt should be unpredictable, however, and is best chosen randomly.

CBC mode requires an initialization vector. This is a block of random data produced for each message by a cryptographic random number generator. It serves as the dummy initial block of ciphertext. Like the key-derivation salt, it doesn't have to be kept secret, and is usually transmitted along with the cipher text.

The password, and keys derived from it, must be kept secret. Even if an attacker has the parameters for key derivation and encryption, and the ciphertext, he can do nothing without the key.

erickson
It's also worth saying that if you have everything but the IV, you can successfully decrypt everything but the first block of plaintext.
caf
A: 

Quick note from cissp: rijndael is the implemented standard for aes. Aes defines three supported key sizes (128, 192, and 256). While (like blowfish) rijndael may allow larger key sizes, I do not think it is accurate to say that aes is a "subset of aes".

Andy Bruce