This repository has been archived by the owner on Jan 3, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Co-authored-by: Jan Machala <jan.machala@email.cz>
- Loading branch information
Showing
6 changed files
with
162 additions
and
24 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
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,19 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace SlevomatEET\Cryptography; | ||
|
||
use Throwable; | ||
|
||
class InvalidPublicKeyException extends PublicKeyFileException | ||
{ | ||
|
||
public function __construct(string $publicKeyFile, string $openSslError, ?Throwable $previous = null) | ||
{ | ||
parent::__construct(sprintf( | ||
'Public key could not be loaded from file \'%s\'. Please make sure that the file contains valid public key in PEM format. (OpenSSL error: %s)', | ||
$publicKeyFile, | ||
$openSslError | ||
), $publicKeyFile, $previous); | ||
} | ||
|
||
} |
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,8 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace SlevomatEET\Cryptography; | ||
|
||
class PrivateKeyFileNotFoundException extends PrivateKeyFileException | ||
{ | ||
|
||
} |
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,26 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace SlevomatEET\Cryptography; | ||
|
||
use Exception; | ||
use Throwable; | ||
|
||
abstract class PublicKeyFileException extends Exception | ||
{ | ||
|
||
/** @var string */ | ||
private $publicKeyFile; | ||
|
||
public function __construct(string $message, string $publicKeyFile, ?Throwable $previous = null) | ||
{ | ||
parent::__construct($message, 0, $previous); | ||
|
||
$this->publicKeyFile = $publicKeyFile; | ||
} | ||
|
||
public function getPublicKeyFile(): string | ||
{ | ||
return $this->publicKeyFile; | ||
} | ||
|
||
} |
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,18 @@ | ||
<?php declare(strict_types = 1); | ||
|
||
namespace SlevomatEET\Cryptography; | ||
|
||
use Throwable; | ||
|
||
class PublicKeyFileNotFoundException extends PublicKeyFileException | ||
{ | ||
|
||
public function __construct(string $publicKeyFile, ?Throwable $previous = null) | ||
{ | ||
parent::__construct(sprintf( | ||
'Public key could not be loaded from file \'%s\'.', | ||
$publicKeyFile | ||
), $publicKeyFile, $previous); | ||
} | ||
|
||
} |
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