File: Sha384Test.php

package info (click to toggle)
php-lcobucci-jwt 5.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,312 kB
  • sloc: php: 6,674; makefile: 49
file content (64 lines) | stat: -rw-r--r-- 1,490 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
<?php
declare(strict_types=1);

namespace Lcobucci\JWT\Tests\Signer\Ecdsa;

use Lcobucci\JWT\Signer\Ecdsa;
use Lcobucci\JWT\Signer\Ecdsa\Sha384;
use Lcobucci\JWT\Signer\InvalidKeyProvided;
use Lcobucci\JWT\Signer\Key;
use Lcobucci\JWT\Signer\OpenSSL;
use PHPUnit\Framework\Attributes as PHPUnit;

use const OPENSSL_ALGO_SHA384;

#[PHPUnit\CoversClass(Ecdsa::class)]
#[PHPUnit\CoversClass(Ecdsa\MultibyteStringConverter::class)]
#[PHPUnit\CoversClass(Ecdsa\Sha384::class)]
#[PHPUnit\CoversClass(OpenSSL::class)]
#[PHPUnit\CoversClass(InvalidKeyProvided::class)]
#[PHPUnit\UsesClass(Key\InMemory::class)]
final class Sha384Test extends EcdsaTestCase
{
    protected function algorithm(): Ecdsa
    {
        return new Sha384($this->pointsManipulator);
    }

    protected function algorithmId(): string
    {
        return 'ES384';
    }

    protected function signatureAlgorithm(): int
    {
        return OPENSSL_ALGO_SHA384;
    }

    protected function pointLength(): int
    {
        return 96;
    }

    protected function keyLength(): int
    {
        return 384;
    }

    protected function verificationKey(): Key
    {
        return self::$ecdsaKeys['public_ec384'];
    }

    protected function signingKey(): Key
    {
        return self::$ecdsaKeys['private_ec384'];
    }

    /** {@inheritDoc} */
    public static function incompatibleKeys(): iterable
    {
        yield '256 bits' => ['private', 256];
        yield '521 bits' => ['private_ec512', 521];
    }
}