title: Data encrypted with openssl_public_encrypt is different every time?
body: <p>why is the content of $encrypted every time different? </p>
  
  <pre><code>// aquire public key from server
  $server_public_key = openssl_pkey_get_public(file_get_contents("C:\publickey.pem"));
  
  // rsa encrypt
  openssl_public_encrypt("123", $encrypted, $server_public_key);
  </code></pre>
  
  <hr>
  
  <p>also I have tried this one</p>
  
  <pre><code>$publicKey = "file://C:/publickey.pem";
  $privateKey = "file://C:/privatekey.pem";
  $plaintext = "String to encrypt";
  
  openssl_public_encrypt($plaintext, $encrypted, $publicKey);
  $transfer = base64_encode($encrypted);
  openssl_private_decrypt($encrypted, $decrypted, $privateKey);
  
  echo $transfer;  //encrypted string
  </code></pre>
  
  <p>and $transfer is everytime a different string:...</p>
  
  <p>Z1xyMUquARxcGjqjjSHNAm41CnHI02GXxLyFivvta8YhDkhRJdD4i3kx+8GElljdiSY/NMF9UD3ritWMLGmscdq/QyIf+geYxJFePNd1dNWg+V6zbAKRLaEpsU+aB87jiM/GjytLEkI63dku02BS0ZBgz9UZw/FDNaynV5bTTDM=</p>
  
  <p>mRgLPsPtMoV9la7zzuU+cLzS5xMDp7QUmH6Iv4Sv4/FNjt62zcv9ZMWkfG3uVhS8Z1UDtGl+met1CYjBTcfjHCR6hahbwOkTCICXtkRQcc371vURW04XhQzMNgIIbvN5BBdmIyYI6alrS2vKUq7b3T0h8sJf36zh5CynYzyDCFU=</p>
  
  <p>G5FhMoJGiUwEBvEOeZpDDrEXdxbWX5iaJ6F+VdYJ3CURPRMftskZNlDhat8gA5V0G+3nXVQZptkHjxMkOqPlmwJHjgIqAiFppHLpEKohyT9qNwkAR00Y6PiWrNUJPiEIZqXHAb8TS0AA0Quhc0UAwcc+I8NGOD59k8BrZE6Z5Ew=</p>