mirror of
https://github.com/phpseclib/phpseclib.git
synced 2024-11-17 02:35:10 +00:00
SSH1: fix "Expected SSH_SMSG_SUCCESS" error
This commit is contained in:
parent
b1c96faf90
commit
c3ee632587
@ -1230,16 +1230,15 @@ class Net_SSH1 {
|
|||||||
// Presumably the part of PKCS#1 they're refering to is "Section 7.2.1 Encryption Operation",
|
// Presumably the part of PKCS#1 they're refering to is "Section 7.2.1 Encryption Operation",
|
||||||
// under "7.2 RSAES-PKCS1-v1.5" and "7 Encryption schemes" of the following URL:
|
// under "7.2 RSAES-PKCS1-v1.5" and "7 Encryption schemes" of the following URL:
|
||||||
// ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf
|
// ftp://ftp.rsasecurity.com/pub/pkcs/pkcs-1/pkcs-1v2-1.pdf
|
||||||
$temp = chr(0) . chr(2);
|
|
||||||
$modulus = $key[1]->toBytes();
|
$modulus = $key[1]->toBytes();
|
||||||
$length = strlen($modulus) - strlen($m) - 3;
|
$length = strlen($modulus) - strlen($m) - 3;
|
||||||
$temp = '';
|
$random = '';
|
||||||
while (strlen($temp) != $length) {
|
while (strlen($random) != $length) {
|
||||||
$block = crypt_random_string($length - strlen($temp));
|
$block = crypt_random_string($length - strlen($random));
|
||||||
$block = str_replace("\x00", '', $block);
|
$block = str_replace("\x00", '', $block);
|
||||||
$temp.= $block;
|
$random.= $block;
|
||||||
}
|
}
|
||||||
$temp.= chr(0) . $m;
|
$temp = chr(0) . chr(2) . $random . chr(0) . $m;
|
||||||
|
|
||||||
$m = new Math_BigInteger($temp, 256);
|
$m = new Math_BigInteger($temp, 256);
|
||||||
$m = $m->modPow($key[0], $key[1]);
|
$m = $m->modPow($key[0], $key[1]);
|
||||||
|
Loading…
Reference in New Issue
Block a user