| Total Complexity | 2 |
| Total Lines | 27 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 16 | final class HMAC extends AbstractSigner implements SignatureAlgorithmInterface |
||
| 17 | { |
||
| 18 | protected const string DEFAULT_BACKEND = Backend\HMAC::class; |
||
|
|
|||
| 19 | |||
| 20 | |||
| 21 | /** |
||
| 22 | * HMAC constructor. |
||
| 23 | * |
||
| 24 | * @param \SimpleSAML\XMLSecurity\Key\SymmetricKey $key The symmetric key to use. |
||
| 25 | * @param string $algId The identifier of this algorithm. |
||
| 26 | */ |
||
| 27 | public function __construct( |
||
| 28 | #[\SensitiveParameter] |
||
| 29 | SymmetricKey $key, |
||
| 30 | string $algId = C::SIG_HMAC_SHA256, |
||
| 31 | ) { |
||
| 32 | parent::__construct($key, $algId, C::$HMAC_DIGESTS[$algId]); |
||
| 33 | } |
||
| 34 | |||
| 35 | |||
| 36 | /** |
||
| 37 | * @return string[] |
||
| 38 | */ |
||
| 39 | public static function getSupportedAlgorithms(): array |
||
| 40 | { |
||
| 41 | return array_keys(C::$HMAC_DIGESTS); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |