Question:
Is there a PHP 5.3 class that enables RSA encryption/decryption without padding? I possess the private and public keys, as well as p, q, and the modulus.
Answer:
phpseclib provides a pure PHP implementation of RSA that can handle encryption and decryption without padding:
<?php include('Crypt/RSA.php'); $private_key = file_get_contents('private.key'); $rsa = new Crypt_RSA(); $rsa->loadKey($private_key); $plaintext = new Math_BigInteger('aaaaaa'); echo $rsa->_exponentiate($plaintext)->toBytes(); ?>
The above is the detailed content of Can PHP 5.3 Implement RSA Encryption/Decryption without Padding?. For more information, please follow other related articles on the PHP Chinese website!