Skip to content

Instantly share code, notes, and snippets.

@dmgig
Created April 20, 2016 18:48
Show Gist options
  • Select an option

  • Save dmgig/798a6a851660a951854fe3d553b54640 to your computer and use it in GitHub Desktop.

Select an option

Save dmgig/798a6a851660a951854fe3d553b54640 to your computer and use it in GitHub Desktop.
PHP Public Key Encryption
<?php
$publicKey = "file://Users/dgiglio/.ssh/mykey.pem";
$plaintext = "String to encrypt";
openssl_public_encrypt($plaintext, $encrypted, $publicKey);
echo $encrypted; //encrypted string
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment