I need support. I want to encrypt string with public key, but when I checked, result is empty.
<?php
use phpseclib\Crypt\RSA;
$publickey = file_get_contents('rsa-public.key');
// echo $publickey;
$rsa = new RSA();
$rsa->loadKey($publickey); // public key
$plaintext = 'serect-key-39f20489-ca80-4cc9-a68b-8c06a5516515';
$ciphertext = base64_encode($rsa->encrypt($plaintext));
echo $ciphertext;
?>
Please advise me. Thanks
via Minh Giang