2022-02-23 03:48:51 +01:00
|
|
|
<?php
|
|
|
|
|
2022-06-04 17:31:21 +02:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
2022-02-23 03:48:51 +01:00
|
|
|
namespace phpseclib3\Tests\Unit\Crypt\EC;
|
|
|
|
|
|
|
|
use phpseclib3\Common\Functions\Strings;
|
|
|
|
use phpseclib3\Crypt\EC\Curves\Ed448;
|
|
|
|
|
|
|
|
class Ed448PrivateKey
|
|
|
|
{
|
2022-06-04 17:31:21 +02:00
|
|
|
public static function load($key, $password = ''): array
|
2022-02-23 03:48:51 +01:00
|
|
|
{
|
|
|
|
if (!Strings::is_stringable($key)) {
|
|
|
|
throw new \UnexpectedValueException('Key should be a string - not a ' . gettype($key));
|
|
|
|
}
|
|
|
|
|
|
|
|
$components = ['curve' => new Ed448()];
|
|
|
|
$components['dA'] = $components['curve']->extractSecret($key);
|
|
|
|
$components['QA'] = $components['curve']->multiplyPoint($components['curve']->getBasePoint(), $components['dA']);
|
|
|
|
|
|
|
|
return $components;
|
|
|
|
}
|
|
|
|
}
|