[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * This file is part of Lcobucci\JWT, a simple library to handle JWT and JWS 4 * 5 * @license http://opensource.org/licenses/BSD-3-Clause BSD-3-Clause 6 */ 7 8 namespace Lcobucci\JWT\Signer; 9 10 use Lcobucci\JWT\Signer\Ecdsa\MultibyteStringConverter; 11 use Lcobucci\JWT\Signer\Ecdsa\SignatureConverter; 12 use const OPENSSL_KEYTYPE_EC; 13 14 /** 15 * Base class for ECDSA signers 16 * 17 * @author Luís Otávio Cobucci Oblonczyk <[email protected]> 18 * @since 2.1.0 19 */ 20 abstract class Ecdsa extends OpenSSL 21 { 22 /** 23 * @var SignatureConverter 24 */ 25 private $converter; 26 27 public function __construct(SignatureConverter $converter = null) 28 { 29 $this->converter = $converter ?: new MultibyteStringConverter(); 30 } 31 32 /** 33 * {@inheritdoc} 34 */ 35 public function createHash($payload, Key $key) 36 { 37 return $this->converter->fromAsn1( 38 parent::createHash($payload, $key), 39 $this->getKeyLength() 40 ); 41 } 42 43 /** 44 * {@inheritdoc} 45 */ 46 public function doVerify($expected, $payload, Key $key) 47 { 48 return parent::doVerify( 49 $this->converter->toAsn1($expected, $this->getKeyLength()), 50 $payload, 51 $key 52 ); 53 } 54 55 /** 56 * Returns the length of each point in the signature, so that we can calculate and verify R and S points properly 57 * 58 * @internal 59 */ 60 abstract public function getKeyLength(); 61 62 /** 63 * {@inheritdoc} 64 */ 65 final public function getKeyType() 66 { 67 return OPENSSL_KEYTYPE_EC; 68 } 69 }
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 |