diff options
Diffstat (limited to 'vendor/web-token/jwt-util-ecc')
-rw-r--r-- | vendor/web-token/jwt-util-ecc/Curve.php | 630 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/LICENSE | 42 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/Math.php | 194 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/ModularArithmetic.php | 70 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/NistCurve.php | 184 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/Point.php | 304 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/PrivateKey.php | 134 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/PublicKey.php | 140 | ||||
-rw-r--r-- | vendor/web-token/jwt-util-ecc/composer.json | 76 |
9 files changed, 887 insertions, 887 deletions
diff --git a/vendor/web-token/jwt-util-ecc/Curve.php b/vendor/web-token/jwt-util-ecc/Curve.php index 8c7d07d..d688598 100644 --- a/vendor/web-token/jwt-util-ecc/Curve.php +++ b/vendor/web-token/jwt-util-ecc/Curve.php @@ -1,315 +1,315 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * @internal - */ -class Curve -{ - /** - * Elliptic curve over the field of integers modulo a prime. - * - * @var \GMP - */ - private $a; - - /** - * @var \GMP - */ - private $b; - - /** - * @var \GMP - */ - private $prime; - - /** - * Binary length of keys associated with these curve parameters. - * - * @var int - */ - private $size; - - /** - * @var Point - */ - private $generator; - - public function __construct(int $size, \GMP $prime, \GMP $a, \GMP $b, Point $generator) - { - $this->size = $size; - $this->prime = $prime; - $this->a = $a; - $this->b = $b; - $this->generator = $generator; - } - - public function getA(): \GMP - { - return $this->a; - } - - public function getB(): \GMP - { - return $this->b; - } - - public function getPrime(): \GMP - { - return $this->prime; - } - - public function getSize(): int - { - return $this->size; - } - - public function getPoint(\GMP $x, \GMP $y, ?\GMP $order = null): Point - { - if (!$this->contains($x, $y)) { - throw new \RuntimeException('Curve '.$this->__toString().' does not contain point ('.Math::toString($x).', '.Math::toString($y).')'); - } - $point = Point::create($x, $y, $order); - if (!\is_null($order)) { - $mul = $this->mul($point, $order); - if (!$mul->isInfinity()) { - throw new \RuntimeException('SELF * ORDER MUST EQUAL INFINITY. ('.(string) $mul.' found instead)'); - } - } - - return $point; - } - - public function getPublicKeyFrom(\GMP $x, \GMP $y): PublicKey - { - $zero = \gmp_init(0, 10); - if (Math::cmp($x, $zero) < 0 || Math::cmp($this->generator->getOrder(), $x) <= 0 || Math::cmp($y, $zero) < 0 || Math::cmp($this->generator->getOrder(), $y) <= 0) { - throw new \RuntimeException('Generator point has x and y out of range.'); - } - $point = $this->getPoint($x, $y); - - return PublicKey::create($point); - } - - public function contains(\GMP $x, \GMP $y): bool - { - $eq_zero = Math::equals( - ModularArithmetic::sub( - Math::pow($y, 2), - Math::add( - Math::add( - Math::pow($x, 3), - Math::mul($this->getA(), $x) - ), - $this->getB() - ), - $this->getPrime() - ), - \gmp_init(0, 10) - ); - - return $eq_zero; - } - - public function add(Point $one, Point $two): Point - { - if ($two->isInfinity()) { - return clone $one; - } - - if ($one->isInfinity()) { - return clone $two; - } - - if (Math::equals($two->getX(), $one->getX())) { - if (Math::equals($two->getY(), $one->getY())) { - return $this->getDouble($one); - } else { - return Point::infinity(); - } - } - - $slope = ModularArithmetic::div( - Math::sub($two->getY(), $one->getY()), - Math::sub($two->getX(), $one->getX()), - $this->getPrime() - ); - - $xR = ModularArithmetic::sub( - Math::sub(Math::pow($slope, 2), $one->getX()), - $two->getX(), - $this->getPrime() - ); - - $yR = ModularArithmetic::sub( - Math::mul($slope, Math::sub($one->getX(), $xR)), - $one->getY(), - $this->getPrime() - ); - - return $this->getPoint($xR, $yR, $one->getOrder()); - } - - public function mul(Point $one, \GMP $n): Point - { - if ($one->isInfinity()) { - return Point::infinity(); - } - - /** @var \GMP $zero */ - $zero = \gmp_init(0, 10); - if (Math::cmp($one->getOrder(), $zero) > 0) { - $n = Math::mod($n, $one->getOrder()); - } - - if (Math::equals($n, $zero)) { - return Point::infinity(); - } - - /** @var Point[] $r */ - $r = [ - Point::infinity(), - clone $one, - ]; - - $k = $this->getSize(); - $n = \str_pad(Math::baseConvert(Math::toString($n), 10, 2), $k, '0', STR_PAD_LEFT); - - for ($i = 0; $i < $k; ++$i) { - $j = $n[$i]; - Point::cswap($r[0], $r[1], $j ^ 1); - $r[0] = $this->add($r[0], $r[1]); - $r[1] = $this->getDouble($r[1]); - Point::cswap($r[0], $r[1], $j ^ 1); - } - - $this->validate($r[0]); - - return $r[0]; - } - - /** - * @param Curve $other - */ - public function cmp(self $other): int - { - $equal = Math::equals($this->getA(), $other->getA()); - $equal &= Math::equals($this->getB(), $other->getB()); - $equal &= Math::equals($this->getPrime(), $other->getPrime()); - - return $equal ? 0 : 1; - } - - /** - * @param Curve $other - */ - public function equals(self $other): bool - { - return 0 === $this->cmp($other); - } - - public function __toString(): string - { - return 'curve('.Math::toString($this->getA()).', '.Math::toString($this->getB()).', '.Math::toString($this->getPrime()).')'; - } - - private function validate(Point $point) - { - if (!$point->isInfinity() && !$this->contains($point->getX(), $point->getY())) { - throw new \RuntimeException('Invalid point'); - } - } - - public function getDouble(Point $point): Point - { - if ($point->isInfinity()) { - return Point::infinity(); - } - - $a = $this->getA(); - $threeX2 = Math::mul(\gmp_init(3, 10), Math::pow($point->getX(), 2)); - - $tangent = ModularArithmetic::div( - Math::add($threeX2, $a), - Math::mul(\gmp_init(2, 10), $point->getY()), - $this->getPrime() - ); - - $x3 = ModularArithmetic::sub( - Math::pow($tangent, 2), - Math::mul(\gmp_init(2, 10), $point->getX()), - $this->getPrime() - ); - - $y3 = ModularArithmetic::sub( - Math::mul($tangent, Math::sub($point->getX(), $x3)), - $point->getY(), - $this->getPrime() - ); - - return $this->getPoint($x3, $y3, $point->getOrder()); - } - - public function createPrivateKey(): PrivateKey - { - return PrivateKey::create($this->generate()); - } - - public function createPublicKey(PrivateKey $privateKey): PublicKey - { - $point = $this->mul($this->generator, $privateKey->getSecret()); - - return PublicKey::create($point); - } - - private function generate(): \GMP - { - $max = $this->generator->getOrder(); - $numBits = $this->bnNumBits($max); - $numBytes = (int) \ceil($numBits / 8); - // Generate an integer of size >= $numBits - $bytes = \random_bytes($numBytes); - $value = Math::stringToInt($bytes); - $mask = \gmp_sub(\gmp_pow(2, $numBits), 1); - $integer = \gmp_and($value, $mask); - - return $integer; - } - - /** - * Returns the number of bits used to store this number. Non-significant upper bits are not counted. - * - * @see https://www.openssl.org/docs/crypto/BN_num_bytes.html - */ - private function bnNumBits(\GMP $x): int - { - $zero = \gmp_init(0, 10); - if (Math::equals($x, $zero)) { - return 0; - } - $log2 = 0; - while (false === Math::equals($x, $zero)) { - $x = Math::rightShift($x, 1); - ++$log2; - } - - return $log2; - } - - public function getGenerator(): Point - { - return $this->generator; - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * @internal
+ */
+class Curve
+{
+ /**
+ * Elliptic curve over the field of integers modulo a prime.
+ *
+ * @var \GMP
+ */
+ private $a;
+
+ /**
+ * @var \GMP
+ */
+ private $b;
+
+ /**
+ * @var \GMP
+ */
+ private $prime;
+
+ /**
+ * Binary length of keys associated with these curve parameters.
+ *
+ * @var int
+ */
+ private $size;
+
+ /**
+ * @var Point
+ */
+ private $generator;
+
+ public function __construct(int $size, \GMP $prime, \GMP $a, \GMP $b, Point $generator)
+ {
+ $this->size = $size;
+ $this->prime = $prime;
+ $this->a = $a;
+ $this->b = $b;
+ $this->generator = $generator;
+ }
+
+ public function getA(): \GMP
+ {
+ return $this->a;
+ }
+
+ public function getB(): \GMP
+ {
+ return $this->b;
+ }
+
+ public function getPrime(): \GMP
+ {
+ return $this->prime;
+ }
+
+ public function getSize(): int
+ {
+ return $this->size;
+ }
+
+ public function getPoint(\GMP $x, \GMP $y, ?\GMP $order = null): Point
+ {
+ if (!$this->contains($x, $y)) {
+ throw new \RuntimeException('Curve '.$this->__toString().' does not contain point ('.Math::toString($x).', '.Math::toString($y).')');
+ }
+ $point = Point::create($x, $y, $order);
+ if (!\is_null($order)) {
+ $mul = $this->mul($point, $order);
+ if (!$mul->isInfinity()) {
+ throw new \RuntimeException('SELF * ORDER MUST EQUAL INFINITY. ('.(string) $mul.' found instead)');
+ }
+ }
+
+ return $point;
+ }
+
+ public function getPublicKeyFrom(\GMP $x, \GMP $y): PublicKey
+ {
+ $zero = \gmp_init(0, 10);
+ if (Math::cmp($x, $zero) < 0 || Math::cmp($this->generator->getOrder(), $x) <= 0 || Math::cmp($y, $zero) < 0 || Math::cmp($this->generator->getOrder(), $y) <= 0) {
+ throw new \RuntimeException('Generator point has x and y out of range.');
+ }
+ $point = $this->getPoint($x, $y);
+
+ return PublicKey::create($point);
+ }
+
+ public function contains(\GMP $x, \GMP $y): bool
+ {
+ $eq_zero = Math::equals(
+ ModularArithmetic::sub(
+ Math::pow($y, 2),
+ Math::add(
+ Math::add(
+ Math::pow($x, 3),
+ Math::mul($this->getA(), $x)
+ ),
+ $this->getB()
+ ),
+ $this->getPrime()
+ ),
+ \gmp_init(0, 10)
+ );
+
+ return $eq_zero;
+ }
+
+ public function add(Point $one, Point $two): Point
+ {
+ if ($two->isInfinity()) {
+ return clone $one;
+ }
+
+ if ($one->isInfinity()) {
+ return clone $two;
+ }
+
+ if (Math::equals($two->getX(), $one->getX())) {
+ if (Math::equals($two->getY(), $one->getY())) {
+ return $this->getDouble($one);
+ } else {
+ return Point::infinity();
+ }
+ }
+
+ $slope = ModularArithmetic::div(
+ Math::sub($two->getY(), $one->getY()),
+ Math::sub($two->getX(), $one->getX()),
+ $this->getPrime()
+ );
+
+ $xR = ModularArithmetic::sub(
+ Math::sub(Math::pow($slope, 2), $one->getX()),
+ $two->getX(),
+ $this->getPrime()
+ );
+
+ $yR = ModularArithmetic::sub(
+ Math::mul($slope, Math::sub($one->getX(), $xR)),
+ $one->getY(),
+ $this->getPrime()
+ );
+
+ return $this->getPoint($xR, $yR, $one->getOrder());
+ }
+
+ public function mul(Point $one, \GMP $n): Point
+ {
+ if ($one->isInfinity()) {
+ return Point::infinity();
+ }
+
+ /** @var \GMP $zero */
+ $zero = \gmp_init(0, 10);
+ if (Math::cmp($one->getOrder(), $zero) > 0) {
+ $n = Math::mod($n, $one->getOrder());
+ }
+
+ if (Math::equals($n, $zero)) {
+ return Point::infinity();
+ }
+
+ /** @var Point[] $r */
+ $r = [
+ Point::infinity(),
+ clone $one,
+ ];
+
+ $k = $this->getSize();
+ $n = \str_pad(Math::baseConvert(Math::toString($n), 10, 2), $k, '0', STR_PAD_LEFT);
+
+ for ($i = 0; $i < $k; ++$i) {
+ $j = $n[$i];
+ Point::cswap($r[0], $r[1], $j ^ 1);
+ $r[0] = $this->add($r[0], $r[1]);
+ $r[1] = $this->getDouble($r[1]);
+ Point::cswap($r[0], $r[1], $j ^ 1);
+ }
+
+ $this->validate($r[0]);
+
+ return $r[0];
+ }
+
+ /**
+ * @param Curve $other
+ */
+ public function cmp(self $other): int
+ {
+ $equal = Math::equals($this->getA(), $other->getA());
+ $equal &= Math::equals($this->getB(), $other->getB());
+ $equal &= Math::equals($this->getPrime(), $other->getPrime());
+
+ return $equal ? 0 : 1;
+ }
+
+ /**
+ * @param Curve $other
+ */
+ public function equals(self $other): bool
+ {
+ return 0 === $this->cmp($other);
+ }
+
+ public function __toString(): string
+ {
+ return 'curve('.Math::toString($this->getA()).', '.Math::toString($this->getB()).', '.Math::toString($this->getPrime()).')';
+ }
+
+ private function validate(Point $point)
+ {
+ if (!$point->isInfinity() && !$this->contains($point->getX(), $point->getY())) {
+ throw new \RuntimeException('Invalid point');
+ }
+ }
+
+ public function getDouble(Point $point): Point
+ {
+ if ($point->isInfinity()) {
+ return Point::infinity();
+ }
+
+ $a = $this->getA();
+ $threeX2 = Math::mul(\gmp_init(3, 10), Math::pow($point->getX(), 2));
+
+ $tangent = ModularArithmetic::div(
+ Math::add($threeX2, $a),
+ Math::mul(\gmp_init(2, 10), $point->getY()),
+ $this->getPrime()
+ );
+
+ $x3 = ModularArithmetic::sub(
+ Math::pow($tangent, 2),
+ Math::mul(\gmp_init(2, 10), $point->getX()),
+ $this->getPrime()
+ );
+
+ $y3 = ModularArithmetic::sub(
+ Math::mul($tangent, Math::sub($point->getX(), $x3)),
+ $point->getY(),
+ $this->getPrime()
+ );
+
+ return $this->getPoint($x3, $y3, $point->getOrder());
+ }
+
+ public function createPrivateKey(): PrivateKey
+ {
+ return PrivateKey::create($this->generate());
+ }
+
+ public function createPublicKey(PrivateKey $privateKey): PublicKey
+ {
+ $point = $this->mul($this->generator, $privateKey->getSecret());
+
+ return PublicKey::create($point);
+ }
+
+ private function generate(): \GMP
+ {
+ $max = $this->generator->getOrder();
+ $numBits = $this->bnNumBits($max);
+ $numBytes = (int) \ceil($numBits / 8);
+ // Generate an integer of size >= $numBits
+ $bytes = \random_bytes($numBytes);
+ $value = Math::stringToInt($bytes);
+ $mask = \gmp_sub(\gmp_pow(2, $numBits), 1);
+ $integer = \gmp_and($value, $mask);
+
+ return $integer;
+ }
+
+ /**
+ * Returns the number of bits used to store this number. Non-significant upper bits are not counted.
+ *
+ * @see https://www.openssl.org/docs/crypto/BN_num_bytes.html
+ */
+ private function bnNumBits(\GMP $x): int
+ {
+ $zero = \gmp_init(0, 10);
+ if (Math::equals($x, $zero)) {
+ return 0;
+ }
+ $log2 = 0;
+ while (false === Math::equals($x, $zero)) {
+ $x = Math::rightShift($x, 1);
+ ++$log2;
+ }
+
+ return $log2;
+ }
+
+ public function getGenerator(): Point
+ {
+ return $this->generator;
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/LICENSE b/vendor/web-token/jwt-util-ecc/LICENSE index a098645..ce18b6a 100644 --- a/vendor/web-token/jwt-util-ecc/LICENSE +++ b/vendor/web-token/jwt-util-ecc/LICENSE @@ -1,21 +1,21 @@ -The MIT License (MIT) - -Copyright (c) 2014-2018 Spomky-Labs - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. +The MIT License (MIT)
+
+Copyright (c) 2014-2018 Spomky-Labs
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/vendor/web-token/jwt-util-ecc/Math.php b/vendor/web-token/jwt-util-ecc/Math.php index e5732da..7d3f5ea 100644 --- a/vendor/web-token/jwt-util-ecc/Math.php +++ b/vendor/web-token/jwt-util-ecc/Math.php @@ -1,97 +1,97 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * @internal - */ -class Math -{ - public static function cmp(\GMP $first, \GMP $other): int - { - return \gmp_cmp($first, $other); - } - - public static function equals(\GMP $first, \GMP $other): bool - { - return 0 === \gmp_cmp($first, $other); - } - - public static function mod(\GMP $number, \GMP $modulus): \GMP - { - return \gmp_mod($number, $modulus); - } - - public static function add(\GMP $augend, \GMP $addend): \GMP - { - return \gmp_add($augend, $addend); - } - - public static function sub(\GMP $minuend, \GMP $subtrahend): \GMP - { - return \gmp_sub($minuend, $subtrahend); - } - - public static function mul(\GMP $multiplier, \GMP $multiplicand): \GMP - { - return \gmp_mul($multiplier, $multiplicand); - } - - public static function pow(\GMP $base, int $exponent): \GMP - { - return \gmp_pow($base, $exponent); - } - - public static function bitwiseAnd(\GMP $first, \GMP $other): \GMP - { - return \gmp_and($first, $other); - } - - public static function bitwiseXor(\GMP $first, \GMP $other): \GMP - { - return \gmp_xor($first, $other); - } - - public static function toString(\GMP $value): string - { - return \gmp_strval($value); - } - - public static function inverseMod(\GMP $a, \GMP $m): \GMP - { - return \gmp_invert($a, $m); - } - - public static function baseConvert(string $number, int $from, int $to): string - { - return \gmp_strval(\gmp_init($number, $from), $to); - } - - public static function rightShift(\GMP $number, int $positions): \GMP - { - return \gmp_div($number, \gmp_pow(\gmp_init(2, 10), $positions)); - } - - public static function stringToInt(string $s): \GMP - { - $result = \gmp_init(0, 10); - $sLen = \mb_strlen($s, '8bit'); - - for ($c = 0; $c < $sLen; ++$c) { - $result = \gmp_add(\gmp_mul(256, $result), \gmp_init(\ord($s[$c]), 10)); - } - - return $result; - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * @internal
+ */
+class Math
+{
+ public static function cmp(\GMP $first, \GMP $other): int
+ {
+ return \gmp_cmp($first, $other);
+ }
+
+ public static function equals(\GMP $first, \GMP $other): bool
+ {
+ return 0 === \gmp_cmp($first, $other);
+ }
+
+ public static function mod(\GMP $number, \GMP $modulus): \GMP
+ {
+ return \gmp_mod($number, $modulus);
+ }
+
+ public static function add(\GMP $augend, \GMP $addend): \GMP
+ {
+ return \gmp_add($augend, $addend);
+ }
+
+ public static function sub(\GMP $minuend, \GMP $subtrahend): \GMP
+ {
+ return \gmp_sub($minuend, $subtrahend);
+ }
+
+ public static function mul(\GMP $multiplier, \GMP $multiplicand): \GMP
+ {
+ return \gmp_mul($multiplier, $multiplicand);
+ }
+
+ public static function pow(\GMP $base, int $exponent): \GMP
+ {
+ return \gmp_pow($base, $exponent);
+ }
+
+ public static function bitwiseAnd(\GMP $first, \GMP $other): \GMP
+ {
+ return \gmp_and($first, $other);
+ }
+
+ public static function bitwiseXor(\GMP $first, \GMP $other): \GMP
+ {
+ return \gmp_xor($first, $other);
+ }
+
+ public static function toString(\GMP $value): string
+ {
+ return \gmp_strval($value);
+ }
+
+ public static function inverseMod(\GMP $a, \GMP $m): \GMP
+ {
+ return \gmp_invert($a, $m);
+ }
+
+ public static function baseConvert(string $number, int $from, int $to): string
+ {
+ return \gmp_strval(\gmp_init($number, $from), $to);
+ }
+
+ public static function rightShift(\GMP $number, int $positions): \GMP
+ {
+ return \gmp_div($number, \gmp_pow(\gmp_init(2, 10), $positions));
+ }
+
+ public static function stringToInt(string $s): \GMP
+ {
+ $result = \gmp_init(0, 10);
+ $sLen = \mb_strlen($s, '8bit');
+
+ for ($c = 0; $c < $sLen; ++$c) {
+ $result = \gmp_add(\gmp_mul(256, $result), \gmp_init(\ord($s[$c]), 10));
+ }
+
+ return $result;
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/ModularArithmetic.php b/vendor/web-token/jwt-util-ecc/ModularArithmetic.php index 29be145..f4b0e0e 100644 --- a/vendor/web-token/jwt-util-ecc/ModularArithmetic.php +++ b/vendor/web-token/jwt-util-ecc/ModularArithmetic.php @@ -1,35 +1,35 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * @internal - */ -class ModularArithmetic -{ - public static function sub(\GMP $minuend, \GMP $subtrahend, \GMP $modulus): \GMP - { - return Math::mod(Math::sub($minuend, $subtrahend), $modulus); - } - - public static function mul(\GMP $multiplier, \GMP $muliplicand, \GMP $modulus): \GMP - { - return Math::mod(Math::mul($multiplier, $muliplicand), $modulus); - } - - public static function div(\GMP $dividend, \GMP $divisor, \GMP $modulus): \GMP - { - return self::mul($dividend, Math::inverseMod($divisor, $modulus), $modulus); - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * @internal
+ */
+class ModularArithmetic
+{
+ public static function sub(\GMP $minuend, \GMP $subtrahend, \GMP $modulus): \GMP
+ {
+ return Math::mod(Math::sub($minuend, $subtrahend), $modulus);
+ }
+
+ public static function mul(\GMP $multiplier, \GMP $muliplicand, \GMP $modulus): \GMP
+ {
+ return Math::mod(Math::mul($multiplier, $muliplicand), $modulus);
+ }
+
+ public static function div(\GMP $dividend, \GMP $divisor, \GMP $modulus): \GMP
+ {
+ return self::mul($dividend, Math::inverseMod($divisor, $modulus), $modulus);
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/NistCurve.php b/vendor/web-token/jwt-util-ecc/NistCurve.php index 70d7070..0cec998 100644 --- a/vendor/web-token/jwt-util-ecc/NistCurve.php +++ b/vendor/web-token/jwt-util-ecc/NistCurve.php @@ -1,92 +1,92 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * ********************************************************************* - * Copyright (C) 2012 Matyas Danter. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * *********************************************************************** - */ - -/** - * @internal - */ -class NistCurve -{ - /** - * Returns an NIST P-256 curve. - */ - public static function curve256(): Curve - { - $p = \gmp_init('ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', 16); - $a = \gmp_init('ffffffff00000001000000000000000000000000fffffffffffffffffffffffc', 16); - $b = \gmp_init('5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b', 16); - $x = \gmp_init('6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296', 16); - $y = \gmp_init('4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5', 16); - $n = \gmp_init('ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551', 16); - $generator = Point::create($x, $y, $n); - - return new Curve(256, $p, $a, $b, $generator); - } - - /** - * Returns an NIST P-384 curve. - */ - public static function curve384(): Curve - { - $p = \gmp_init('fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff', 16); - $a = \gmp_init('fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc', 16); - $b = \gmp_init('b3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef', 16); - $x = \gmp_init('aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7', 16); - $y = \gmp_init('3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f', 16); - $n = \gmp_init('ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973', 16); - $generator = Point::create($x, $y, $n); - - return new Curve(384, $p, $a, $b, $generator); - } - - /** - * Returns an NIST P-521 curve. - */ - public static function curve521(): Curve - { - $p = \gmp_init('000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16); - $a = \gmp_init('000001fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc', 16); - $b = \gmp_init('00000051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00', 16); - $x = \gmp_init('000000c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66', 16); - $y = \gmp_init('0000011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650', 16); - $n = \gmp_init('000001fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409', 16); - $generator = Point::create($x, $y, $n); - - return new Curve(521, $p, $a, $b, $generator); - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * *********************************************************************
+ * Copyright (C) 2012 Matyas Danter.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * ***********************************************************************
+ */
+
+/**
+ * @internal
+ */
+class NistCurve
+{
+ /**
+ * Returns an NIST P-256 curve.
+ */
+ public static function curve256(): Curve
+ {
+ $p = \gmp_init('ffffffff00000001000000000000000000000000ffffffffffffffffffffffff', 16);
+ $a = \gmp_init('ffffffff00000001000000000000000000000000fffffffffffffffffffffffc', 16);
+ $b = \gmp_init('5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b', 16);
+ $x = \gmp_init('6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296', 16);
+ $y = \gmp_init('4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5', 16);
+ $n = \gmp_init('ffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551', 16);
+ $generator = Point::create($x, $y, $n);
+
+ return new Curve(256, $p, $a, $b, $generator);
+ }
+
+ /**
+ * Returns an NIST P-384 curve.
+ */
+ public static function curve384(): Curve
+ {
+ $p = \gmp_init('fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff', 16);
+ $a = \gmp_init('fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc', 16);
+ $b = \gmp_init('b3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef', 16);
+ $x = \gmp_init('aa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7', 16);
+ $y = \gmp_init('3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f', 16);
+ $n = \gmp_init('ffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973', 16);
+ $generator = Point::create($x, $y, $n);
+
+ return new Curve(384, $p, $a, $b, $generator);
+ }
+
+ /**
+ * Returns an NIST P-521 curve.
+ */
+ public static function curve521(): Curve
+ {
+ $p = \gmp_init('000001ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff', 16);
+ $a = \gmp_init('000001fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc', 16);
+ $b = \gmp_init('00000051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00', 16);
+ $x = \gmp_init('000000c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66', 16);
+ $y = \gmp_init('0000011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650', 16);
+ $n = \gmp_init('000001fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409', 16);
+ $generator = Point::create($x, $y, $n);
+
+ return new Curve(521, $p, $a, $b, $generator);
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/Point.php b/vendor/web-token/jwt-util-ecc/Point.php index bf73b2b..6fcee1d 100644 --- a/vendor/web-token/jwt-util-ecc/Point.php +++ b/vendor/web-token/jwt-util-ecc/Point.php @@ -1,152 +1,152 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * ********************************************************************* - * Copyright (C) 2012 Matyas Danter. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * *********************************************************************** - */ - -/** - * @internal - */ -class Point -{ - /** - * @var \GMP - */ - private $x; - - /** - * @var \GMP - */ - private $y; - - /** - * @var \GMP - */ - private $order; - - /** - * @var bool - */ - private $infinity = false; - - /** - * Initialize a new instance. - * - * @throws \RuntimeException when either the curve does not contain the given coordinates or - * when order is not null and P(x, y) * order is not equal to infinity - */ - private function __construct(\GMP $x, \GMP $y, \GMP $order, bool $infinity = false) - { - $this->x = $x; - $this->y = $y; - $this->order = $order; - $this->infinity = $infinity; - } - - /** - * @return Point - */ - public static function create(\GMP $x, \GMP $y, ?\GMP $order = null): self - { - return new self($x, $y, null === $order ? \gmp_init(0, 10) : $order); - } - - /** - * @return Point - */ - public static function infinity(): self - { - $zero = \gmp_init(0, 10); - - return new self($zero, $zero, $zero, true); - } - - public function isInfinity(): bool - { - return $this->infinity; - } - - public function getOrder(): \GMP - { - return $this->order; - } - - public function getX(): \GMP - { - return $this->x; - } - - public function getY(): \GMP - { - return $this->y; - } - - /** - * @param Point $a - * @param Point $b - */ - public static function cswap(self $a, self $b, int $cond) - { - self::cswapGMP($a->x, $b->x, $cond); - self::cswapGMP($a->y, $b->y, $cond); - self::cswapGMP($a->order, $b->order, $cond); - self::cswapBoolean($a->infinity, $b->infinity, $cond); - } - - private static function cswapBoolean(bool &$a, bool &$b, int $cond) - { - $sa = \gmp_init((int) ($a), 10); - $sb = \gmp_init((int) ($b), 10); - - self::cswapGMP($sa, $sb, $cond); - - $a = (bool) \gmp_strval($sa, 10); - $b = (bool) \gmp_strval($sb, 10); - } - - private static function cswapGMP(\GMP &$sa, \GMP &$sb, int $cond) - { - $size = \max(\mb_strlen(\gmp_strval($sa, 2), '8bit'), \mb_strlen(\gmp_strval($sb, 2), '8bit')); - $mask = (string) (1 - (int) ($cond)); - $mask = \str_pad('', $size, $mask, STR_PAD_LEFT); - $mask = \gmp_init($mask, 2); - $taA = Math::bitwiseAnd($sa, $mask); - $taB = Math::bitwiseAnd($sb, $mask); - $sa = Math::bitwiseXor(Math::bitwiseXor($sa, $sb), $taB); - $sb = Math::bitwiseXor(Math::bitwiseXor($sa, $sb), $taA); - $sa = Math::bitwiseXor(Math::bitwiseXor($sa, $sb), $taB); - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * *********************************************************************
+ * Copyright (C) 2012 Matyas Danter.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * ***********************************************************************
+ */
+
+/**
+ * @internal
+ */
+class Point
+{
+ /**
+ * @var \GMP
+ */
+ private $x;
+
+ /**
+ * @var \GMP
+ */
+ private $y;
+
+ /**
+ * @var \GMP
+ */
+ private $order;
+
+ /**
+ * @var bool
+ */
+ private $infinity = false;
+
+ /**
+ * Initialize a new instance.
+ *
+ * @throws \RuntimeException when either the curve does not contain the given coordinates or
+ * when order is not null and P(x, y) * order is not equal to infinity
+ */
+ private function __construct(\GMP $x, \GMP $y, \GMP $order, bool $infinity = false)
+ {
+ $this->x = $x;
+ $this->y = $y;
+ $this->order = $order;
+ $this->infinity = $infinity;
+ }
+
+ /**
+ * @return Point
+ */
+ public static function create(\GMP $x, \GMP $y, ?\GMP $order = null): self
+ {
+ return new self($x, $y, null === $order ? \gmp_init(0, 10) : $order);
+ }
+
+ /**
+ * @return Point
+ */
+ public static function infinity(): self
+ {
+ $zero = \gmp_init(0, 10);
+
+ return new self($zero, $zero, $zero, true);
+ }
+
+ public function isInfinity(): bool
+ {
+ return $this->infinity;
+ }
+
+ public function getOrder(): \GMP
+ {
+ return $this->order;
+ }
+
+ public function getX(): \GMP
+ {
+ return $this->x;
+ }
+
+ public function getY(): \GMP
+ {
+ return $this->y;
+ }
+
+ /**
+ * @param Point $a
+ * @param Point $b
+ */
+ public static function cswap(self $a, self $b, int $cond)
+ {
+ self::cswapGMP($a->x, $b->x, $cond);
+ self::cswapGMP($a->y, $b->y, $cond);
+ self::cswapGMP($a->order, $b->order, $cond);
+ self::cswapBoolean($a->infinity, $b->infinity, $cond);
+ }
+
+ private static function cswapBoolean(bool &$a, bool &$b, int $cond)
+ {
+ $sa = \gmp_init((int) ($a), 10);
+ $sb = \gmp_init((int) ($b), 10);
+
+ self::cswapGMP($sa, $sb, $cond);
+
+ $a = (bool) \gmp_strval($sa, 10);
+ $b = (bool) \gmp_strval($sb, 10);
+ }
+
+ private static function cswapGMP(\GMP &$sa, \GMP &$sb, int $cond)
+ {
+ $size = \max(\mb_strlen(\gmp_strval($sa, 2), '8bit'), \mb_strlen(\gmp_strval($sb, 2), '8bit'));
+ $mask = (string) (1 - (int) ($cond));
+ $mask = \str_pad('', $size, $mask, STR_PAD_LEFT);
+ $mask = \gmp_init($mask, 2);
+ $taA = Math::bitwiseAnd($sa, $mask);
+ $taB = Math::bitwiseAnd($sb, $mask);
+ $sa = Math::bitwiseXor(Math::bitwiseXor($sa, $sb), $taB);
+ $sb = Math::bitwiseXor(Math::bitwiseXor($sa, $sb), $taA);
+ $sa = Math::bitwiseXor(Math::bitwiseXor($sa, $sb), $taB);
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/PrivateKey.php b/vendor/web-token/jwt-util-ecc/PrivateKey.php index d33fb5b..4444ab7 100644 --- a/vendor/web-token/jwt-util-ecc/PrivateKey.php +++ b/vendor/web-token/jwt-util-ecc/PrivateKey.php @@ -1,67 +1,67 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * ********************************************************************* - * Copyright (C) 2012 Matyas Danter. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * *********************************************************************** - */ - -/** - * @internal - */ -class PrivateKey -{ - /** - * @var \GMP - */ - private $secret; - - private function __construct(\GMP $secret) - { - $this->secret = $secret; - } - - /** - * @return PrivateKey - */ - public static function create(\GMP $secret): self - { - return new self($secret); - } - - public function getSecret(): \GMP - { - return $this->secret; - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * *********************************************************************
+ * Copyright (C) 2012 Matyas Danter.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * ***********************************************************************
+ */
+
+/**
+ * @internal
+ */
+class PrivateKey
+{
+ /**
+ * @var \GMP
+ */
+ private $secret;
+
+ private function __construct(\GMP $secret)
+ {
+ $this->secret = $secret;
+ }
+
+ /**
+ * @return PrivateKey
+ */
+ public static function create(\GMP $secret): self
+ {
+ return new self($secret);
+ }
+
+ public function getSecret(): \GMP
+ {
+ return $this->secret;
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/PublicKey.php b/vendor/web-token/jwt-util-ecc/PublicKey.php index a85c0e2..7aa50f0 100644 --- a/vendor/web-token/jwt-util-ecc/PublicKey.php +++ b/vendor/web-token/jwt-util-ecc/PublicKey.php @@ -1,70 +1,70 @@ -<?php - -declare(strict_types=1); - -/* - * The MIT License (MIT) - * - * Copyright (c) 2014-2018 Spomky-Labs - * - * This software may be modified and distributed under the terms - * of the MIT license. See the LICENSE file for details. - */ - -namespace Jose\Component\Core\Util\Ecc; - -/** - * ********************************************************************* - * Copyright (C) 2012 Matyas Danter. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES - * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * *********************************************************************** - */ - -/** - * @internal - */ -class PublicKey -{ - /** - * @var Point - */ - private $point; - - /** - * PublicKey constructor. - */ - private function __construct(Point $point) - { - $this->point = $point; - } - - /** - * @return PublicKey - */ - public static function create(Point $point): self - { - return new self($point); - } - - public function getPoint(): Point - { - return $this->point; - } -} +<?php
+
+declare(strict_types=1);
+
+/*
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2014-2018 Spomky-Labs
+ *
+ * This software may be modified and distributed under the terms
+ * of the MIT license. See the LICENSE file for details.
+ */
+
+namespace Jose\Component\Core\Util\Ecc;
+
+/**
+ * *********************************************************************
+ * Copyright (C) 2012 Matyas Danter.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining
+ * a copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included
+ * in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES
+ * OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
+ * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ * ***********************************************************************
+ */
+
+/**
+ * @internal
+ */
+class PublicKey
+{
+ /**
+ * @var Point
+ */
+ private $point;
+
+ /**
+ * PublicKey constructor.
+ */
+ private function __construct(Point $point)
+ {
+ $this->point = $point;
+ }
+
+ /**
+ * @return PublicKey
+ */
+ public static function create(Point $point): self
+ {
+ return new self($point);
+ }
+
+ public function getPoint(): Point
+ {
+ return $this->point;
+ }
+}
diff --git a/vendor/web-token/jwt-util-ecc/composer.json b/vendor/web-token/jwt-util-ecc/composer.json index 0598e3e..ea0784d 100644 --- a/vendor/web-token/jwt-util-ecc/composer.json +++ b/vendor/web-token/jwt-util-ecc/composer.json @@ -1,38 +1,38 @@ -{ - "name": "web-token/jwt-util-ecc", - "description": "ECC Tools for the JWT Framework.", - "type": "library", - "license": "MIT", - "keywords": ["JWS", "JWT", "JWE", "JWA", "JWK", "JWKSet", "Jot", "Jose", "RFC7515", "RFC7516", "RFC7517", "RFC7518", "RFC7519", "RFC7520", "Bundle", "Symfony"], - "homepage": "https://github.com/web-token", - "authors": [ - { - "name": "Florent Morselli", - "homepage": "https://github.com/Spomky" - },{ - "name": "All contributors", - "homepage": "https://github.com/web-token/jwt-core/contributors" - } - ], - "autoload": { - "psr-4": { - "Jose\\Component\\Core\\Util\\Ecc\\": "" - } - }, - "require": { - "php": "^7.1", - "ext-gmp": "*", - "ext-mbstring": "*" - }, - "require-dev": { - "phpunit/phpunit": "^6.0|^7.0" - }, - "extra": { - "branch-alias": { - "dev-master": "1.3.x-dev" - } - }, - "config": { - "sort-packages": true - } -} +{
+ "name": "web-token/jwt-util-ecc",
+ "description": "ECC Tools for the JWT Framework.",
+ "type": "library",
+ "license": "MIT",
+ "keywords": ["JWS", "JWT", "JWE", "JWA", "JWK", "JWKSet", "Jot", "Jose", "RFC7515", "RFC7516", "RFC7517", "RFC7518", "RFC7519", "RFC7520", "Bundle", "Symfony"],
+ "homepage": "https://github.com/web-token",
+ "authors": [
+ {
+ "name": "Florent Morselli",
+ "homepage": "https://github.com/Spomky"
+ },{
+ "name": "All contributors",
+ "homepage": "https://github.com/web-token/jwt-core/contributors"
+ }
+ ],
+ "autoload": {
+ "psr-4": {
+ "Jose\\Component\\Core\\Util\\Ecc\\": ""
+ }
+ },
+ "require": {
+ "php": "^7.1",
+ "ext-gmp": "*",
+ "ext-mbstring": "*"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^6.0|^7.0"
+ },
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.3.x-dev"
+ }
+ },
+ "config": {
+ "sort-packages": true
+ }
+}
|