我正在尝试加密要通过API发送给身份验证的密码。我的情况与another encrypt example
非常相似python部分的格式为see the get_pwd_rsa function
Python部分:
import rsa
key = rsa.PublicKey(n,e)
encropy_pwd = rsa.encrypt(message,key)
binascii.b2a_hex(encropy_pwd)
我已经尝试使用phpseclib解决我的问题,但是加密结果不正确:
use phpseclib\Crypt\RSA;
$rsa = new RSA();
$rsa->loadKey([
'n' => new \phpseclib\Math\BigInteger($n,16),'e' => new \phpseclib\Math\BigInteger($e,]);
$ciphertext = $rsa->encrypt($message);
return bin2hex($ciphertext);
加密结果不正确,我不确定我缺少哪一部分。