# Recovering key in AES - Infinitely many known plaintext ciphertext pairs

Is it possible to recover key/algorithm in AES encryption more efficiently than via brute force given attacker has access to arbitrarily many plaintext ciphertext pairs. If so, are there other known techniques which are secure even in the scenario of arbitrarily many known ciphertext plain text pairs?

For any given AES key there are only $2^{128}$ possible plaintext-ciphertext pairs, so you can never have arbitrarily many such pairs. Moreover, if the attacker has access to all $2^{128}$ such pairs for a given key they can mount a "code-book" attack, whereby they don't need the key at all to decrypt any message that they want to decrypt. For example, if they see any particular 128 bit block of ciphertext the attacker can simply query their database of possible plaintext-ciphertext pairs and directly find the corresponding plaintext, without ever needing to go through the trouble of breaking the key.
• This answer is correct, if we assume reasonable practical limits on the resources available to the attacker. This in no way contradicts J.D.'s answer, since one of those practical limits is that nobody can actually perform the $2^{128}$ AES encryptions theoretically needed to obtain all the possible plaintext/ciphertext pairs. – Ilmari Karonen Feb 27 '17 at 15:26