I had a look at the example in RSA phpseclib.
- Code: Select all
<?php
include('Crypt/RSA.php');
$rsa = new Crypt_RSA();
extract($rsa->createKey());
$plaintext = 'terrafrost';
$rsa->loadKey($privatekey);
$ciphertext = $rsa->encrypt($plaintext);
$rsa->loadKey($publickey);
echo $rsa->decrypt($ciphertext);
?>
As I see it encrypts with private key. But the RSA specs tells that it should be done with public key. Check it out: http://en.wikipedia.org/wiki/RSA
Any thoughts?
