title: Prevent replay attacks with Public/Private Key-Encryption of HTTP GET Parameters using Mcrypt and PHP
body: <p>I want to create a a game application, for that i want the client to send to server scores and other information that should be encrypted. </p>
  
  <p>I understood that there is a way with <code>mcrypt</code> to encrypt data with public and private keys. so the application on the client side will encrypt but I am the only one that will be able to decrypt it. I don't have much more information to go on, i just want to know the most secure way to paste data. </p>
  
  <p>What I understood so far is this example:</p>
  
  <p>if I have: <code>?username=foo&amp;score=50&amp;msg=hello</code><br>
  I can encrypt it to: <code>msgencrypted=fgus9g8uywe978ygt7923y5235sdfdsadfsd</code> (example)</p>
  
  <p>and only with a specific key that I have on my server I can decrypt it.</p>
  
  <p>Again I'm just trying to find the best method to hide data from the user so he won't be able to decrypt it.</p>
  
  <p>which means that if I encrypted a message... that message won't be able to be sent twice.</p>
  
  <p>So if the user used firebug to see what a request was sent and tries to send it again, the message will be invalid. I guess I can just record it in a database. But if there is a method for such a thing it would be great.</p>
  
  <p>I am using PHP 5.4.</p>