-
Notifications
You must be signed in to change notification settings - Fork 85
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
1 parent
4f90faa
commit d990caa
Showing
9 changed files
with
66 additions
and
0 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,7 @@ | ||
<?php | ||
namespace ParagonIE\Halite\Alerts; | ||
|
||
class InvalidSignature extends HaliteAlert | ||
{ | ||
|
||
} |
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
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 |
---|---|---|
@@ -1,13 +1,21 @@ | ||
<?php | ||
namespace ParagonIE\Halite\Symmetric; | ||
|
||
use \ParagonIE\Halite\Util as CryptoUtil; | ||
use \ParagonIE\Halite\Alerts as CryptoException; | ||
|
||
final class AuthenticationKey extends SecretKey | ||
{ | ||
/** | ||
* @param string $keyMaterial - The actual key data | ||
*/ | ||
public function __construct($keyMaterial = '', ...$args) | ||
{ | ||
if (CryptoUtil::safeStrlen($keyMaterial) !== \Sodium\CRYPTO_AUTH_KEYBYTES) { | ||
throw new CryptoException\InvalidKey( | ||
'Authentication key must be CRYPTO_AUTH_KEYBYTES bytes long' | ||
); | ||
} | ||
parent::__construct($keyMaterial, true); | ||
} | ||
} |
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 |
---|---|---|
@@ -1,13 +1,21 @@ | ||
<?php | ||
namespace ParagonIE\Halite\Symmetric; | ||
|
||
use \ParagonIE\Halite\Util as CryptoUtil; | ||
use \ParagonIE\Halite\Alerts as CryptoException; | ||
|
||
final class EncryptionKey extends SecretKey | ||
{ | ||
/** | ||
* @param string $keyMaterial - The actual key data | ||
*/ | ||
public function __construct($keyMaterial = '', ...$args) | ||
{ | ||
if (CryptoUtil::safeStrlen($keyMaterial) !== \Sodium\CRYPTO_STREAM_KEYBYTES) { | ||
throw new CryptoException\InvalidKey( | ||
'Encryption key must be CRYPTO_STREAM_KEYBYTES bytes long' | ||
); | ||
} | ||
parent::__construct($keyMaterial, false); | ||
} | ||
} |