[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/libraries/vendor/web-auth/cose-lib/src/Algorithm/Signature/EdDSA/ -> ED256.php (source)

   1  <?php
   2  
   3  declare(strict_types=1);
   4  
   5  /*
   6   * The MIT License (MIT)
   7   *
   8   * Copyright (c) 2014-2019 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 Cose\Algorithm\Signature\EdDSA;
  15  
  16  use Cose\Key\Key;
  17  
  18  final class ED256 extends EdDSA
  19  {
  20      public const ID = -260;
  21  
  22      public static function identifier(): int
  23      {
  24          return self::ID;
  25      }
  26  
  27      public function sign(string $data, Key $key): string
  28      {
  29          $hashedData = hash('sha256', $data, true);
  30  
  31          return parent::sign($hashedData, $key);
  32      }
  33  
  34      public function verify(string $data, Key $key, string $signature): bool
  35      {
  36          $hashedData = hash('sha256', $data, true);
  37  
  38          return parent::verify($hashedData, $key, $signature);
  39      }
  40  }


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer