I am using WAMP 2.4.4. To encrypt a String I used the "MyEncryption" class, but the error is:
Call to undefined function openssl_public_encrypt()
Is there any special library that i must add before using openssl_public_encrypt()
class MyEncryption
{
public $pubkey = '...public key here...';
public $privkey = '...private key here...';
function encrypt($data)
{
if (openssl_public_encrypt($data, $encrypted, $this->pubkey))
$data = base64_encode($encrypted);
else
throw new Exception('Unable to encrypt data. Perhaps it is bigger than the key size?');
return $data;
}
}
$url = new MyEncryption();
$d = "Hello World";
$enc = $url->encrypt($d);
echo "Encryption is: ", $enc;