I am encrypting a string in a format like this:
Byte 1: 1 (this byte is CONSTANT and KNOWN)
Byte 2-18: a random string of characters that is never the same.
Byte 18-34: unknown number that is sequentially incremented each time
(it's a primary key from a mySQL AUTOINCREMENT column)
The entire 34 bytes is encrypted using 128 bit AES key.
Let's assume the attacker has access to several million of these strings that were generated sequentially and the attacker has them in order. This means the attacker knows that Bytes 18-34 are several million integers, each exactly 1 apart (eg, 100, 101, 102, 103, etc).
Could the attacker:
- Figure out the AES key if the IV used to encrypt all the strings is the same?
- Figure out the AES key if the IV used to encrypt all the strings is NOT the same (one IV per string), but known?
- WITHOUT figuring out the full key, would it be possible for the attacker to compose their own string that allows them to set their own known value for bytes 18-34, and simply put garbage in the rest of the bytes?
AES is supposed to be immune from known plaintext attacks, but I am having trouble wrapping my head around how far that extends in practice.
Many thanks in advance.