Tests: add test for garbage collected primefield

This commit is contained in:
terrafrost 2023-07-26 21:23:08 -05:00
parent f01892a9db
commit 69325956ce
1 changed files with 17 additions and 0 deletions

View File

@ -20,4 +20,21 @@ class PrimeFieldTest extends PhpseclibTestCase
echo $num2->squareRoot();
}
/**
* @group github1929
*/
public function testGarbageCollectedToBytes()
{
$blob = base64_decode('BFgsTFQeqKr0toyURbtT43INMDS7FTHjz3yn3MR1/Yv/pb2b9ZCYNQ/Tafe5hQpEJ4TpZOKfikP/hWZvFL8QCPgqbIGqw/KTfA==');
$public = "\0" . substr($blob, 0, 49);
$private = substr($blob, -24);
$point = \phpseclib3\Crypt\EC\Formats\Keys\PKCS1::extractPoint(
$public,
new \phpseclib3\Crypt\EC\Curves\secp192r1()
);
$point[0]->toBytes();
}
}