Assume that two devices are communicating via some sort of method that can be publicly viewed, and replicated. Attackers have the ability to replicate information sent between the two, and attackers can listen to the transfers. Assume that both devices can't tell if they're receiving communication from the other device, or from an attacker.
What cryptographic techniques can allow the information to not be read by the attackers (encryption), but also allow old packets of information to be validated that they came from a legitimate device? Also, how could two packets which are identical be made to not appear identical to attackers?
I'm developed a solution which I think accomplishes all of these goals, but there must have been solutions already created for this purpose. It takes the payload data, concatenates the equivalent of a two-factory authentication code which changes every few seconds, and concatenates a random number on, so identical payloads will look different. Then, the whole payload is encrypted using some sort of symmetric encryption. Both devices already have a shared secret key file.
I feel like there has to be some other sort of solution out here, but I don't know what it's called or what to research. I don't want to "roll my own crypto," and I want to find an existing, verified solution. Can anyone give me some topics to investigate?