mirror of
https://github.com/phpseclib/phpseclib.git
synced 2025-01-13 18:02:58 +00:00
Tests/RSA: fix bad merge
This commit is contained in:
parent
4516227f13
commit
1e7bfe75b1
@ -160,8 +160,8 @@ class Random
|
|||||||
throw new \RuntimeException(__CLASS__ . ' requires at least one symmetric cipher be loaded');
|
throw new \RuntimeException(__CLASS__ . ' requires at least one symmetric cipher be loaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
$crypto->setKey($key);
|
$crypto->setKey(substr($key, 0, $crypto->getKeyLength() >> 3));
|
||||||
$crypto->setIV($iv);
|
$crypto->setIV(substr($iv, 0, $crypto->getBlockLength() >> 3));
|
||||||
$crypto->enableContinuousBuffer();
|
$crypto->enableContinuousBuffer();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ class Random
|
|||||||
* @param mixed $arr
|
* @param mixed $arr
|
||||||
* @access public
|
* @access public
|
||||||
*/
|
*/
|
||||||
function safe_serialize(&$arr)
|
static function safe_serialize(&$arr)
|
||||||
{
|
{
|
||||||
if (is_object($arr)) {
|
if (is_object($arr)) {
|
||||||
return '';
|
return '';
|
||||||
|
@ -66,7 +66,6 @@ p0GbMJDyR4e9T04ZZwIDAQAB
|
|||||||
$this->assertTrue($rsa->verify('zzzz', $sig));
|
$this->assertTrue($rsa->verify('zzzz', $sig));
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \OutOfBoundsException
|
* @expectedException \OutOfBoundsException
|
||||||
*/
|
*/
|
||||||
@ -122,13 +121,15 @@ U9VQQSQzY1oZMVX8i1m5WUTLPz2yLJIBQVdXqhMCQBGoiuSoSjafUhV7i1cEGpb88h5NBYZzWXGZ
|
|||||||
-----END RSA PRIVATE KEY-----';
|
-----END RSA PRIVATE KEY-----';
|
||||||
$rsa->load($privatekey);
|
$rsa->load($privatekey);
|
||||||
$rsa->setSaltLength(0);
|
$rsa->setSaltLength(0);
|
||||||
|
$rsa->setHash('sha1');
|
||||||
|
$rsa->setMGFHash('sha1');
|
||||||
|
|
||||||
// Check we generate the correct signature.
|
// Check we generate the correct signature.
|
||||||
$sig = pack('H*', '0ddfc93548e21d015c0a289a640b3b79aecfdfae045f583c5925b91cc5c399bba181616ad6ae20d9662d966f0eb2fddb550f4733268e34d640f4c9dadcaf25b3c82c42130a5081c6ebad7883331c65b25b6a37ffa7c4233a468dae56180787e2718ed87c48d8d50b72f5850e4a40963b4f36710be250ecef6fe0bb91249261a3');
|
$sig = pack('H*', '0ddfc93548e21d015c0a289a640b3b79aecfdfae045f583c5925b91cc5c399bba181616ad6ae20d9662d966f0eb2fddb550f4733268e34d640f4c9dadcaf25b3c82c42130a5081c6ebad7883331c65b25b6a37ffa7c4233a468dae56180787e2718ed87c48d8d50b72f5850e4a40963b4f36710be250ecef6fe0bb91249261a3');
|
||||||
$this->assertEquals($sig, $rsa->sign($plaintext));
|
$this->assertEquals($sig, $rsa->sign($plaintext));
|
||||||
|
|
||||||
// Check we can verify the signature correctly.
|
// Check we can verify the signature correctly.
|
||||||
$rsa->loadKey($rsa->getPublicKey());
|
$rsa->load($rsa->getPublicKey());
|
||||||
$this->assertTrue($rsa->verify($plaintext, $sig));
|
$this->assertTrue($rsa->verify($plaintext, $sig));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user