# Finding IV in AES-128 having partial Key and plaintext

Let's suppose we have the plaintext, 14/16 char of the key and the first 2 and the last 36 chars of encrypted data (that is 64 char long). What I want is to find the IV. The cipher algorithm is AES (I think 128).

As I said, both the Key and the IV are 16 char long, the plaintext is exactly 32 char long and the cyphertext produced is 64.

What tool / process can I use to find the IV knowing all of this stuff? Note that I don't know the full key, but I have a big part of it, so probably some bruteforce is needed.

• This very much sounds like a homework problem. Go re-read how AES works, and pay special attention to how the IV, plaintext, and key are used to create the first block of ciphertext. You've got a bit of an a = f(b, x) situation where you have everything you need to solve for x, but you need to understand a bit better how f() works. – Mike Ounsworth Mar 27 '20 at 18:05
• I'm implicitly assuming that the mode of operation is CBC. I think here the char=byte. if the message is 32 byte => you need padding and for CBC the most common is the PKCS#7 padding. The value is 16 0x10 in hex. By using this and the last two ciphertexts one can find the key by looking the small 16-bit key search in known plaintetext attack. There are 4 bocks since usullay the IV is prepended to the ciphertext. It is not clear about the knowledge of the plaintext. If it is not known, one cannot find the IV, if known, it is a simple implementation... – kelalaka Mar 28 '20 at 20:18
• Yes, it's AES with CBC mode. The plaintext is fully known. – G0D0T Mar 28 '20 at 22:31
• Then it is a simple implementation. Find the key by the last encryption, the reveal, all. – kelalaka Mar 29 '20 at 9:08