A question for an exam asks me to provide data integrity of a file F with AES and a shared secret key between Alice and Bob, if there is a way. The message is sent by Alice to Bob.
I thought of the following protocol:
- Alice sends to Bob (Ek(F||k), F), where Ek means the encryption by AES with the secret k of the file F concatenated with the secret k.
- Bob receives the message, takes F, concatenates k and computes AES. If equal, he accepts the message, if not he rejects it.
Could this approach work well? What could the attacker do?