i have a file, which was encrypted with AES-128 in CBC mode. I know the content of original file and know the iv used to encrypt that file.So, just wondering if it's possible to recover the key used from the information provided.


Ciphers are designed to withstand far more adverse situations than the single known plaintext/ciphertext pair that you describe. In particular, they are intended to be secure against chosen plaintext attacks, where:

  1. The attacker submits plaintexts of their choice and are shown the resulting ciphertexts, as many times as they like;
  2. The attacker's goal isn't to recover the key, but just telling the cipher apart from random results, which is much easier.

There are no known practical chosen plaintext attacks against AES, and there are security proofs for CBC mode.

There are of course impractical attacks that work only in theory. You could just attempt $2^n$ distinct keys and you have a $1/2^n$ chance of finding the right one. But that means that you need $2^{127}$ attempts—about $1.7 \times 10^{38}$, an astronomically large number—to have a 50% chance of success.

| improve this answer | |

Not the answer you're looking for? Browse other questions tagged or ask your own question.