I've to encrypt in PHP a 16 chars string by the RSA algoritm and PKCS#1 pattern with a public key included in a certificate (called SanitalCF.cer). Finally have to encode in base64.
I tryed this code, what's wrong?
function EncryptData($source)
{
$fp=fopen("cert/SanitelCF.cer","r");
$pub_key=fread($fp,8192);
fclose($fp);
openssl_public_encrypt($source,$crypttext, $pub_key );
return(base64_encode($crypttext));
}