garsaud / cryptstreamaes
Encrypt and decrypt php resources (streams) on-the-fly using AES 128, 192, 256
Installs: 6
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/garsaud/cryptstreamaes
Requires
- php: >=8.1
- ext-mcrypt: *
Requires (Dev)
README
This package encrypts and decrypts resources (streams) using AES 128, 192 or 256 using mcrypt.
It operates on resources (local or remote obtained via fopen(…)) in chunks, making it possible to process very large contents without exceeding the memory limit.
Installation
composer require garsaud/cryptstreamaes
Usage
use Garsaud\CryptStreamAES\AES; use Garsaud\CryptStreamAES\Length; $aes = new AES(Length::AES256); $aes->encrypt( key: 'B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF', inputStream: fopen('myfile.jpg', 'rb'), outputStream: fopen('myfile-encrypted.bin', 'wb'), );
use Garsaud\CryptStreamAES\AES; use Garsaud\CryptStreamAES\Length; $aes = new AES(Length::AES256); $aes->decrypt( key: 'B374A26A71490437AA024E4FADD5B497FDFF1A8EA6FF12F6FB65AF2720B59CCF', inputStream: fopen('myfile-encrypted.bin', 'rb'), outputStream: fopen('myfile.jpg', 'wb'), );