Score:1

Is it safe to encrypt a message with AES-ECB two times?

er flag

Suppose we have a function that returns a chipertext of a known plaintext that has been encrypted twice with AES-ECB with two unknown keys, is it possible to get both keys ?

forest avatar
vn flag
To get both keys? No, but ECB is not IND-CPA secure, so it's not _safe_ to do that on more than one block.
Score:1
in flag

No, you cannot get either of the keys for the simple reason that any block cipher should protect the key against any attack, including known plaintext attacks. In which mode the cipher is used doesn't matter.

There are attacks possible on block ciphers if they are used with separate keys. But as long as the keys are used once, for one particular purpose then it is unlikely that you run into problems until the amount of ciphertext is really high. In your scheme you'd have to iterate through both keys to attack it this way.

As mentioned in the comments, this change does not make ECB secure because you can still distinguish identical plaintext blocks as the ciphertext would match. Furthermore, double ECB is prone to meet in the middle attacks. Using a larger key and / or a more complex block cipher would be preferable.

Score:0
cd flag

If you have a 256 bit chunk of plaintext and ciphertext then in ECB mode you make it much much easier to get the AES key especially if precalculations are involved and if a key is derived from a bad password (dictionary attack). Shit stacks up... If you encrypt the plaintext twice with 2 different AES keys, then you make it more difficult of course. Nevertheless, better just do not use ECB mode in the first place. CBC is the king of the hill :)

I sit in a Tesla and translated this thread with Ai:

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.