Skip to content

Instantly share code, notes, and snippets.

@freretuc
Created May 2, 2015 15:08
Show Gist options
  • Save freretuc/4be873016da77bbeb9e7 to your computer and use it in GitHub Desktop.
Save freretuc/4be873016da77bbeb9e7 to your computer and use it in GitHub Desktop.
Encrypt string with PHP.
<?php
$content = "secret";
$public = file_get_contents("public.pem");
openssl_public_encrypt($content, $crypted, $public, OPENSSL_PKCS1_OAEP_PADDING);
echo base64_encode($crypted);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment