I want to encrypt 128 bits of data. I understand the problem with ECB, so I generate a 128-bit Initialization Vector to use for encryption and send with the encrypted data. Is there a "best" way to apply this IV?
The Block Cipher Modes of Operation can use the IV in a couple of ways:
The IV is XOR'd with the payload, then this is used as the plaintext for AES, then the AES output is the ciphertext.
The IV is the plaintext for AES, and the output is XOR'd with the payload, then this is the ciphertext.
My system is not concerned with a stream of data, only a single 128-bit block. The receiver can never be expected to have received a prior 128-bit message. So, the modes of operation (CBC, CTR, GCM, etc.) are not fully applicable.
Are each of these functionally the same for that single block? Instead of applying the IV "before" or "after" as above, what if I XOR'd the key with the IV?