| Recommend this page to a friend! |
| Info | Documentation | Reputation | Support forum | Blog | Links |
| Last Updated | Ratings | Unique User Downloads | Download Rankings | |||||
| 2026-06-24 (3 days ago) | Not yet rated by the users | Total: Not yet counted | Not yet ranked | |||||
| Version | License | PHP version | Categories | |||
| phpcypherfile 1.0 | MIT/X Consortium ... | 5 | PHP 5, Files and Folders, Cryptography |
| Description | Author | |
This package provides symmetric encryption of large files using RSA keys. |
To install this library, you can use Composer. Run the following command:
composer require bigb06/phpcypherfile
Basic code to use PHPCypherFile (see example.php for full example and keys generation):
se PHPCypherFile\PHPCypherFile;
// Encrypt the file
PHPCypherFile::encryptFile($inputFile, $encryptedFile,$publicKey);
// Decrypt the file
PHPCypherFile::decryptFile($encryptedFile, $decryptedFile,$privateKey);
Keys Generation
$config = [
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
];
$res = openssl_pkey_new($config);
openssl_pkey_export($res, $privateKeyString);
$details = openssl_pkey_get_details($res);
$publicKeyString = $details["key"];
$publicKey = openssl_pkey_get_public($publicKeyString);
$privateKey = openssl_pkey_get_private($privateKeyString);
You can also refer to example.php for detailed steps on how to generate the required RSA public/private keys for encryption and decryption.
PHPCypherFile provides a robust solution for encrypting large files securely without significant memory overhead. It combines the power of RSA for public/private key encryption and AES-256-CBC for symmetric encryption, ensuring both performance and security.
Large File Support:
Files are encrypted in chunks, minimizing memory usage during the encryption/decryption process. This ensures scalability for handling large files.
Hybrid Encryption Scheme:
- random symmetric key is generated for AES-256-CBC encryption of the file content. - The symmetric key and IV (Initialization Vector) are encrypted with a public RSA key.
Minimal Memory Footprint:
By processing files in small chunks, the class avoids loading the entire file into memory.
To install this library, you can use Composer. Run the following command:
composer require bigb06/phpcypherfile
Basic code to use PHPCypherFile (see example.php for full example and keys generation):
use PHPCypherFile\PHPCypherFile;
// Encrypt the file
PHPCypherFile::encryptFile($inputFile, $encryptedFile,$publicKey);
// Decrypt the file
PHPCypherFile::decryptFile($encryptedFile, $decryptedFile,$privateKey);
$config = [
"private_key_bits" => 4096,
"private_key_type" => OPENSSL_KEYTYPE_RSA,
];
$res = openssl_pkey_new($config);
openssl_pkey_export($res, $privateKeyString);
$details = openssl_pkey_get_details($res);
$publicKeyString = $details["key"];
$publicKey = openssl_pkey_get_public($publicKeyString);
$privateKey = openssl_pkey_get_private($privateKeyString);
You can also refer to example.php for detailed steps on how to generate the required RSA public/private keys for encryption and decryption.
This project is open source and available under the MIT License.
| File | Role | Description | ||
|---|---|---|---|---|
| Data | Auxiliary data | |||
| Aux. | Configuration script | |||
| Lic. | License text | |||
| Doc. | Documentation | |||
| The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page. |
| Version Control | Unique User Downloads | |||||||
| 100% |
|
| Applications that use this package |
If you know an application of this package, send a message to the author to add a link here.