[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 declare(strict_types=1); 4 5 /* 6 * The MIT License (MIT) 7 * 8 * Copyright (c) 2014-2020 Spomky-Labs 9 * 10 * This software may be modified and distributed under the terms 11 * of the MIT license. See the LICENSE file for details. 12 */ 13 14 namespace Jose\Component\Signature\Algorithm; 15 16 use function in_array; 17 use InvalidArgumentException; 18 use Jose\Component\Core\JWK; 19 20 final class None implements SignatureAlgorithm 21 { 22 public function allowedKeyTypes(): array 23 { 24 return ['none']; 25 } 26 27 public function sign(JWK $key, string $input): string 28 { 29 $this->checkKey($key); 30 31 return ''; 32 } 33 34 public function verify(JWK $key, string $input, string $signature): bool 35 { 36 return '' === $signature; 37 } 38 39 public function name(): string 40 { 41 return 'none'; 42 } 43 44 /** 45 * @throws InvalidArgumentException if the key type is invalid 46 */ 47 private function checkKey(JWK $key): void 48 { 49 if (!in_array($key->get('kty'), $this->allowedKeyTypes(), true)) { 50 throw new InvalidArgumentException('Wrong key type.'); 51 } 52 } 53 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |