Php – Encrypt and Decrypt text with RSA in PHP

PHPrsa

Is there any class for PHP 5.3 that provides RSA encryption/decryption without padding?

I've got private and public key, p,q, and modulus.

Best Answer

You can use phpseclib, a pure PHP RSA implementation:

<?php
include('Crypt/RSA.php');

$privatekey = file_get_contents('private.key');

$rsa = new Crypt_RSA();
$rsa->loadKey($privatekey);

$plaintext = new Math_BigInteger('aaaaaa');
echo $rsa->_exponentiate($plaintext)->toBytes();
?>