delboy1978uk / bone-crypt
An openssl based encryption/decryption class
v1.0.2
2021-11-13 14:25 UTC
Requires
- ext-json: *
- ext-openssl: *
Requires (Dev)
This package is auto-updated.
Last update: 2024-11-13 21:06:49 UTC
README
An openssl based encryption/decryption class
installation
Install via composer
composer require delboy1978uk/bone-crypt
usage
To encrypt and decrypt a value
use Bone\Crypt\Crypt; $crypt = new Crypt(); // returns array with key, IV, tag, and ciphertext $encrypted = $crypt->encrypt('Super secret data'); // Take the key out of the array and json encode $key = $encrypted['key']; unset($encrypted['key']); // this is your payload. Save the key somewhere! $json = \json_encode($encrypted); // To decrypt $result = $this->crypt->decrypt($json, $key); // 'Super secret data'