If I use the output of a cipher, for example a block cipher such as AES and encrypt it again with the same algorithm, I read that this introduces weaknesses into the overall security of the system.
Is this the case?
|
If I use the output of a cipher, for example a block cipher such as AES and encrypt it again with the same algorithm, I read that this introduces weaknesses into the overall security of the system. Is this the case? |
|||||||
|
|
I'd like to expand on some claims in previous answers. @AlbertVeli writes "encrypting a block twice with the same algorithm and key ... does not increase security". Rule of thumb is that it's true, however, you can imagine a crypto algorithm with not good enough properties, like bit diffusion. With such algo, applying encryption twice even with the same key may make it more secure (against non brute force attack). But not talking about same keys, applying same algorithm several times definitely can improve the strength, actually, that's how venerable 3DES works - once original DES was found too weak, guys just took 3 times more bits, split them in 3 keys, and applied one after another (they did extra trick of applying "encryp-decrypt-encrypt"). Finally, it should be noted that a typical crypto algorithm consists of number of same (or highly similar) rounds. Each of them works while not with the same key, but with the set of keys directly derived from the original (i.e. inter-related). It's exactly repetition of these small sub-algos sufficient number of times what makes overall algo secure. For example, there're known attacks on reduced-rounds AES, but after some number of rounds, diffusion and permutation are that much, that dataflow analysis becomes infeasible (so far). So, summing up, applying same algorithm several times can lead to continuum of consequences - from complete annihilation of encryption (XOR 2 times with the same key) to turning otherwise non-secure crypto-primitive into a really secure encryption. |
|||
|
|
|
No, encrypting a block twice with the same algorithm and key does not introduce any weakness. But on the other hand, it does not increase security either. The only difference is that a brute-force attack will take twice as long to perform. In the case of AES a brute-force attack already takes long enough to perform so there is no need to encrypt twice. If you have several blocks and want to encrypt them with the same cipher and key, then the security depends on what mode you choose. In short, never use Electronic Code Book. If the clear-text is the same for two blocks, the cipher-text will also be identical in ECB mode. If you use CBC, make sure to always use a random IV. The IV must not be predictable. A good way is to encrypt a nonce and use the output as IV for CBC. The nonce value may not repeat as long as the same key is used. The recommended mode is ctr. It has several advantages over CBC (ctr can be computed in parallel, you can encrypt more blocks with ctr than CBC before having to change key, you never need a dummy padding block with ctr and if both sender and receiver keep count of the ctr variable, then you don't even have to include the ctr, in CBC you will have to send the IV in cleartext). Edit. If you use counter mode, do not encrypt the same block twice with the same key and counter. The encryptions will cancel each other and produce the clear-text as cipher-text. |
||||
|
|
Well, I don't know where you read that. However, depending on what they meant by that, that's either nonsense, or an appropriate cautionary tale. What is known is that encrypting again cannot make the cipher weaker, as long as the keys you chose to encrypt a second time are independent of the keys you use the first time. The logic behind this is straight-forward; the attacker is assumed to know everything about the cipher except the keys. If he has some ciphertext that he wants to attack, there's nothing preventing him from picking his own "second time key", and then encrypting the ciphertext to form a doubly-encrypted ciphertext. If double-encrypting was inherently weaker, then he could attack that (and hence single-encryption would be equally weak). On the other hand, if the two keys you use during the first and the second use are the same, this logic does not apply. And, in fact, there are ciphers where this encrypting twice with the same key is a Bad Idea. For example, some ciphers will, if you run the ciphertext through a second time with the same key, will generate a 'doubly-encrypted ciphertext' that is exactly the same as the plaintext; this is obviously weaker than the 'singly-encrypted ciphertext' |
|||||||||||||
|