1
$\begingroup$

When using symmetric cipher, does the following statement holds:

E(x, k) means encrypting x with key k in ECB mode

E(E(x, k1), k2) = E(E(x, k2), k1) ?

Then the decryption could go in opposite way round and the message x would be the same.

$\endgroup$
4
  • $\begingroup$ I think the term you are looking for is commutative-encryption. Modern block ciphers are not commutative, so the statement does not hold for them in ECB mode. $\endgroup$
    – mikeazo
    Jul 10, 2015 at 14:24
  • 3
    $\begingroup$ Your title is backwards: you want to decrypt in the same order as you encrypted. If you decrypt in the opposite order, it always works. $\endgroup$
    – cpast
    Jul 10, 2015 at 19:09
  • $\begingroup$ @SEJPM With CTR, it depends a bit on how you deal with the IV. If the second encryption also encrypts the IV from the first encryption, then the output is different. $\endgroup$
    – cpast
    Jul 10, 2015 at 19:16
  • $\begingroup$ @cpast, thank you. corrected TL;DR: Won't work with ECB (as asked in your question). Will work with CTR, if you don't encrypt the IV. $\endgroup$
    – SEJPM
    Jul 10, 2015 at 19:21

0

Browse other questions tagged or ask your own question.