ali-eltaweel / openssl-codec
There is no license information available for the latest version (1.0.0) of this package.
OpenSSL codec.
1.0.0
2025-06-29 06:16 UTC
Requires
- php: ^8.1
- ext-openssl: *
- ali-eltaweel/codecs: ^1.0.0
This package is auto-updated.
Last update: 2025-06-29 06:20:33 UTC
README
Installation
Install openssl-codec via Composer:
composer require ali-eltaweel/openssl-codec
Usage
Encoding
use Codecs\OpenSSLCodec; // store this in a secure place $iv = openssl_random_pseudo_bytes(openssl_cipher_iv_length('aes-128-gcm')); $codec = new OpenSSLCodec('aes-128-gcm', 'MySuperDuperSecretPassphrase', $iv); $code = $codec->encode('Super Secret Data');
Decoding
use Codecs\OpenSSLCodec; // load the same IV used for encoding $iv = ''; $codec = new OpenSSLCodec('aes-128-gcm', 'MySuperDuperSecretPassphrase', $iv); $superSecretData = $codec->decode($code);