https://github.com/shgysk8zer0/phpcrypt
Provides a variety of cryptographic traits and classes to PHP
https://github.com/shgysk8zer0/phpcrypt
aes aes256 cryptography jscrypt php php-7 phpcrypt rsa spl-autoload traits
Last synced: 2 months ago
JSON representation
Provides a variety of cryptographic traits and classes to PHP
- Host: GitHub
- URL: https://github.com/shgysk8zer0/phpcrypt
- Owner: shgysk8zer0
- License: gpl-3.0
- Created: 2017-01-29T07:54:31.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-10-27T06:39:46.000Z (over 8 years ago)
- Last Synced: 2025-01-19T18:43:57.798Z (about 1 year ago)
- Topics: aes, aes256, cryptography, jscrypt, php, php-7, phpcrypt, rsa, spl-autoload, traits
- Language: PHP
- Homepage:
- Size: 57.6 KB
- Stars: 1
- Watchers: 4
- Forks: 3
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# PHPCrypt
[](https://gitter.im/shgysk8zer0/phpcrypt?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[](https://travis-ci.org/shgysk8zer0/phpcrypt)
> Provides easy to use classes and traits for cryptographic functions using `openssl_*`. Intended
> to be compatible with [JSCrypt](https://github.com/shgysk8zer0/JSCrypt) &
> [SubtleCrypto / JWK](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey)
## Requires:
- **PHP >= 7**
- [openssl](https://secure.php.net/manual/en/book.openssl.php)
## Installation:
- Best if imported as a Git submodule using [`git submodule add git://github.com/shgysk8zer0/phpcrypt.git`](https://git-scm.com/book/en/v2/Git-Tools-Submodules)
- Use [`spl_autoload`](https://secure.php.net/manual/en/function.spl-autoload-register.php) for autoloading
## Provided classes:
- [`PublicKey`](https://github.com/shgysk8zer0/phpcrypt/blob/master/publickey.php)
- [`PrivateKey`](https://github.com/shgysk8zer0/phpcrypt/blob/master/privatekey.php)
- [`KeyPair`](https://github.com/shgysk8zer0/phpcrypt/blob/master/keypair.php)
- [`FormSign`](https://github.com/shgysk8zer0/phpcrypt/blob/master/formsign.php)
## Provided traits:
- [`Traits\KeyPair`](https://github.com/shgysk8zer0/phpcrypt/blob/master/traits/keypair.php)
- [`Traits\AES`](https://github.com/shgysk8zer0/phpcrypt/blob/master/traits/aes.php)
- [`Traits\Password`](https://github.com/shgysk8zer0/phpcrypt/blob/master/traits/password.php)
## Provided interfaces:
- [`Interfaces\Key`](https://github.com/shgysk8zer0/phpcrypt/blob/master/interfaces/key.php)
### Example code:
```php
encrypt(MESSAGE);
$decrypted = $keys->decrypt($encrypted);
$sig = $keys->sign($encrypted);
$valid = $keys->verify($encrypted, $sig);
$matches = MESSAGE === $decrypted;
```