-
Notifications
You must be signed in to change notification settings - Fork 8
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
15 changed files
with
358 additions
and
283 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
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,7 +1,9 @@ | ||
# Philosophy | ||
|
||
- Use PHP's native functions instead of polyfills | ||
- Require no external dependencies | ||
- Use strong typing and strict type enforcement | ||
- Use strong typing and strict type enforcement over type-checking conditional code | ||
- Make source as simple as possible to audit | ||
- Prefer clarity over backwards compatibility | ||
- Lowest possible SLOC to achieve goals | ||
- Iterate often to obtain perfection |
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,34 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* Aes256Ecb.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt; | ||
|
||
/** | ||
* Symmetric AES-256-ECB encryption functions powered by OpenSSL. | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
class Aes256Ecb extends Aes256Gcm | ||
{ | ||
/** | ||
* AES-256 cipher identifier that will be passed to openssl | ||
* | ||
* @var string | ||
*/ | ||
const CIPHER = 'aes-256-ecb'; | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* Aes256Ecb.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt; | ||
|
||
/** | ||
* Symmetric AES-256-ECB encryption functions powered by OpenSSL. | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
class Aes256Ecb extends Aes256Gcm | ||
{ | ||
/** | ||
* AES-256 cipher identifier that will be passed to openssl | ||
* | ||
* @var string | ||
*/ | ||
const CIPHER = 'aes-256-ecb'; | ||
} |
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,34 +1,34 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* Aes256Ofb.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt; | ||
|
||
/** | ||
* Symmetric AES-256-GCM encryption functions powered by OpenSSL. | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
class Aes256Ofb extends Aes256Gcm | ||
{ | ||
/** | ||
* AES-256 cipher identifier that will be passed to openssl | ||
* | ||
* @var string | ||
*/ | ||
const CIPHER = 'aes-256-ofb'; | ||
} | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* Aes256Ofb.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt; | ||
|
||
/** | ||
* Symmetric AES-256-GCM encryption functions powered by OpenSSL. | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
class Aes256Ofb extends Aes256Gcm | ||
{ | ||
/** | ||
* AES-256 cipher identifier that will be passed to openssl | ||
* | ||
* @var string | ||
*/ | ||
const CIPHER = 'aes-256-ofb'; | ||
} |
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,20 +1,29 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* InvalidChecksumException.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt\Exceptions; | ||
|
||
class InvalidChecksumException extends \Exception | ||
{ | ||
|
||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* InvalidChecksumException.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt\Exceptions; | ||
|
||
/** | ||
* A handler for checksum exceptions | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
class InvalidChecksumException extends \Exception | ||
{ | ||
const MESSAGE = 'Invalid ciphertext checksum'; | ||
} |
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,20 +1,30 @@ | ||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* InvalidKeyException.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt\Exceptions; | ||
|
||
class InvalidKeyException extends \Exception | ||
{ | ||
|
||
<?php declare(strict_types=1); | ||
|
||
/** | ||
* InvalidKeyException.php | ||
* | ||
* PHP version 7 | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
|
||
namespace Dcrypt\Exceptions; | ||
|
||
/** | ||
* A handler for key exceptions | ||
* | ||
* @category Dcrypt | ||
* @package Dcrypt | ||
* @author Michael Meyer (mmeyer2k) <m.meyer2k@gmail.com> | ||
* @license http://opensource.org/licenses/MIT The MIT License (MIT) | ||
* @link https://github.com/mmeyer2k/dcrypt | ||
*/ | ||
class InvalidKeyException extends \Exception | ||
{ | ||
const KEYLENGTH = 'Key must be at least 2048 bytes and base64 encoded'; | ||
const KEYRANDOM = 'Key does not contain the minimum amount of entropy'; | ||
} |
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.