0
我现在遇到了RSA问题。 我在Javascript和PHP一样系数和指数,都使用PKCS#在JavaScript 1 ,我用http://www-cs-students.stanford.edu/~tjw/jsbn/rsa.jsJavaScript中的RSA与PHP不同
var rsa = new RSAKey();
rsa.setPublic("modulus","ex");
var result = rsa.encrypt(text);
,并在PHP中,我使用http://phpseclib.sourceforge.net/
require_once 'Crypt/RSA.php';
$rsa = new Crypt_RSA();
$n="modulus";
$e="ex";
$rsa->modulus= new Math_BigInteger($n,16);
$rsa->publicExponent= new Math_BigInteger($e,16);
$key=$rsa->getPublicKey();
$rsa->loadKey($key);
$rsa->setEncryptionMode(CRYPT_RSA_ENCRYPTION_PKCS1);
$ciphertext = $rsa->encrypt("1234");
echo bin2hex($ciphertext);
但2的结果是不同。 可以任何请告诉我原因。非常感谢
非常感谢。我明白 。 – 2012-09-16 05:34:38
但严重的是,实际上并不使用* PKCS#1填充。 – 2016-03-06 19:07:51