| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Jose\Component\Signature\Algorithm; |
| 6 | |
| 7 | use InvalidArgumentException; |
| 8 | use Jose\Component\Core\JWK; |
| 9 | |
| 10 | final class HS384 extends HMAC |
| 11 | { |
| 12 | public function name(): string |
| 13 | { |
| 14 | return 'HS384'; |
| 15 | } |
| 16 | |
| 17 | protected function getHashAlgorithm(): string |
| 18 | { |
| 19 | return 'sha384'; |
| 20 | } |
| 21 | |
| 22 | protected function getKey(JWK $key): string |
| 23 | { |
| 24 | $k = parent::getKey($key); |
| 25 | if (mb_strlen($k, '8bit') < 48) { |
| 26 | throw new InvalidArgumentException('Invalid key length.'); |
| 27 | } |
| 28 | |
| 29 | return $k; |
| 30 | } |
| 31 | } |