Download the PHP package ericledberg/php-encryption without Composer
On this page you can find all versions of the php package ericledberg/php-encryption. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download ericledberg/php-encryption
More information about ericledberg/php-encryption
Files in ericledberg/php-encryption
Package php-encryption
Short Description A PHP class that provides encryption functionality using OpenSSL AES CBC encryption
License MIT
Informations about the package php-encryption
PHP-Encryption - A PHP Class for Encryption and Decryption
PHP-Encryption is a class that provides SYMETRIC encryption and decryption functionality using the OpenSSL library. It uses the Advanced Encryption Standard (AES) algorithm in Cipher-Block Chaining (CBC) mode for secure data encryption.
Remember, keeping encryption keys secure and private are essential to maintaining data security. This excescise is left to the user application.
Features
- Ability to import encryption keys from a secured ".env" file or set by the application at run-time
- Strong encryption of the data using AES-256-CBC cipher
- Optionally calculate HMAC_HASH on originally-encrypted data
- Optionally combines the encrypted data and it's HMAC_HASH and encrypts it a second time sing KEY2
- Optionally will compare the originally encrypted data to it's HMAC_HASH to verify it was not tampered with
Installation
Install PHP-Encryption via Composer using the following command:
composer require ericledberg/PHP-Encryption
Alternatively, you can manually download and include the cksEncryption.php file in your PHP project.
Optionally, initialize .ENV keyfile:
- Locate Example.env in: Composer/vendor/php-encryption
- Copy example to: cp Example.env .env
- For production, generate new keys and update .env
- Update .env permissions to limit access
- sudo chown root .env
- sudo chgrp apache2 .env
- sudo chmod 440 .env
Example: Composer Using .ENV To Store Keys
Here's an example of how to use PHP-Encryption in your PHP code using composer.
ericledberg/php-encryption
Example: Simple Require Class
Security Considerations
- Properly manage encryption keys and keep them confidential and protected from unauthorized access.
- Store encrypted data and encryption keys securely with appropriate access controls.
- Validate and sanitize input data to prevent potential security vulnerabilities.
- Regularly audit and review the implementation for security risks.
- Ensure compliance with applicable data protection laws and industry regulations, especially when handling sensitive data.
Contribution
Contributions to PHP-Encryption are welcome! Please submit issues and pull requests to the GitHub repository at https://github.com/ericledberg/PHP-Encryption.
License
PHP-Encryption is released under the MIT License, which allows for both personal and commercial use. Please see the LICENSE file for more details.
Credits
PHP-Encryption was created by ericledberg and is inspired by various PHP encryption libraries and best practices for encryption and key management.