__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
<?php
namespace Tuf\Tests\Unit;
use Tuf\Key;
use PHPUnit\Framework\TestCase;
/**
* @coversDefaultClass \Tuf\Key
*/
class KeyTest extends TestCase
{
/**
* @covers ::createFromMetadata
* @covers ::getComputedKeyId
* @covers ::getPublic
* @covers ::getType
*
* @dataProvider providerCreateFromMetadata
*/
public function testCreateFromMetadata(array $data): void
{
$data += [
'keytype' => 'ed25519',
'scheme' => 'scheme-ed11111',
'keyval' => ['public' => '12345'],
];
$key = Key::createFromMetadata($data);
self::assertInstanceOf(Key::class, $key);
self::assertSame('ed25519', $key->getType());
self::assertSame('12345', $key->getPublic());
$keySortedCanonicalStruct = [
'keyid_hash_algorithms' => ['sha256', 'sha512'],
'keytype' => 'ed25519',
'keyval' => ['public' => '12345'],
'scheme' => 'scheme-ed11111',
];
$keyCanonicalForm = json_encode($keySortedCanonicalStruct, JSON_UNESCAPED_SLASHES);
self::assertSame(hash('sha256', $keyCanonicalForm), $key->getComputedKeyId());
}
/**
* Dataprovider for testCreateFromMetadata
* @return mixed[]
*/
public function providerCreateFromMetadata(): array
{
return [
'without keyid_hash_algorithms' => [
[],
],
'with keyid_hash_algorithms' => [
[
'keyid_hash_algorithms' => ["sha256", "sha512"],
],
]
];
}
}
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| Client | Folder | 0775 |
|
|
| CanonicalJsonTraitTest.php | File | 3.16 KB | 0664 |
|
| DelegatedRoleTest.php | File | 5.39 KB | 0664 |
|
| FileStorageTest.php | File | 5.03 KB | 0664 |
|
| KeyTest.php | File | 1.59 KB | 0664 |
|
| RepositoryTest.php | File | 2.43 KB | 0664 |
|
| RoleTest.php | File | 2.58 KB | 0664 |
|
| SizeCheckingLoaderTest.php | File | 4.46 KB | 0664 |
|