Debian Codegraph @

lib/3rdParty/composer/web-token/jwt-library/Signature/Algorithm/HS256.php

raw symbols SCIP
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 HS256 extends HMAC
11 {
12 public function name(): string
13 {
14 return 'HS256';
15 }
16
17 protected function getHashAlgorithm(): string
18 {
19 return 'sha256';
20 }
21
22 protected function getKey(JWK $key): string
23 {
24 $k = parent::getKey($key);
25 if (mb_strlen($k, '8bit') < 32) {
26 throw new InvalidArgumentException('Invalid key length.');
27 }
28
29 return $k;
30 }
31 }