forked from phpecc/phpecc
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
432 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "tests/import/wycheproof"] | ||
path = tests/import/wycheproof | ||
url = https://github.com/google/wycheproof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit bootstrap="tests/bootstrap.php" colors="true" | ||
convertErrorsToExceptions="true" convertNoticesToExceptions="true" | ||
convertWarningsToExceptions="true" processIsolation="false" | ||
stopOnFailure="false"> | ||
<php> | ||
<const name="PHPUNIT_DEBUG" value="false" /> | ||
<ini name="display_errors" value="On" /> | ||
<ini name="error_reporting" value="32767" /> | ||
</php> | ||
<testsuites> | ||
<testsuite name="WycheProof tests"> | ||
<directory suffix="Test.php">./tests/wycheproof</directory> | ||
</testsuite> | ||
<testsuite name="Unit tests"> | ||
<directory suffix="Test.php">./tests/unit</directory> | ||
</testsuite> | ||
</testsuites> | ||
<logging> | ||
<log type="coverage-html" target="./tests/output/Coverage/" | ||
charset="UTF-8" yui="true" highlight="true" /> | ||
<log type="junit" target="./tests/output/Results/Results.xml" | ||
logIncompleteSkipped="true" /> | ||
</logging> | ||
<filter> | ||
<whitelist addUncoveredFilesFromWhitelist="true"> | ||
<directory suffix=".php">src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
class EccException extends \Exception | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
class ExchangeException extends EccException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
class NumberTheoryException extends EccException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
class PointException extends EccException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
use Mdanter\Ecc\Primitives\CurveFpInterface; | ||
|
||
class PointNotOnCurveException extends PointException | ||
{ | ||
public function __construct(\GMP $x, \GMP $y, CurveFpInterface $curve) | ||
{ | ||
parent::__construct("Curve " . $curve . " does not contain point (" . gmp_strval($x, 10) . ", " . gmp_strval($y, 10) . ")"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
class PointRecoveryException extends PointException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
use Mdanter\Ecc\Primitives\GeneratorPoint; | ||
use Mdanter\Ecc\Primitives\PointInterface; | ||
use Throwable; | ||
|
||
class PublicKeyException extends EccException | ||
{ | ||
/** | ||
* @var GeneratorPoint | ||
*/ | ||
private $G; | ||
|
||
/** | ||
* @var PointInterface | ||
*/ | ||
private $point; | ||
|
||
public function __construct(GeneratorPoint $G, PointInterface $point, string $message = "", int $code = 0, Throwable $previous = null) | ||
{ | ||
$this->G = $G; | ||
$this->point = $point; | ||
parent::__construct($message, $code, $previous); | ||
} | ||
|
||
public function getGenerator(): GeneratorPoint | ||
{ | ||
return $this->G; | ||
} | ||
|
||
public function getPoint(): PointInterface | ||
{ | ||
return $this->point; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace Mdanter\Ecc\Exception; | ||
|
||
class SquareRootException extends NumberTheoryException | ||
{ | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.