PHP Classes

How to Use the PHP OpenSSL Extension to Encrypt and Decrypt data Using the Package Crypto Helper: Encrypt and decrypt data using OpenSSL

Recommend this page to a friend!
     
  Info   View files Files   Install with Composer Install with Composer   Download Download   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings
2025-02-20 (Yesterday) RSS 2.0 feedNot yet rated by the usersTotal: Not yet counted Not yet ranked
Version License PHP version Categories
cryptohelper 1.0MIT/X Consortium ...5PHP 5, Cryptography
Description 

Author

This class can encrypt and decrypt texts using the OpenSSL extension.

It can take encryption key and information vector values to encrypt data using the aes-256-CBC cipher algorithm.

The class can decrypt previously encrypted data decrypt it and return the original encrypted data.

Picture of Paulo Rodrigues
Name: Paulo Rodrigues <contact>
Classes: 1 package by
Country: Brazil Brazil

Instructions

The CryptoHelper class provides methods to encrypt and decrypt texts using the AES-256-CBC algorithm.

It requires a secret key and an initialization vector (IV), both encoded in Base64, ensuring that data remains securely protected.

The class automatically validates whether the key is 32 bytes and the IV is 16 bytes, as required by AES-256-CBC. &#128313; Methods:

__construct($key, $iv):
Initializes the class, decoding and validating the key and IV.

encryption($plainText):
Encrypts a text and returns the result in Base64.

decryptAES($cipherText):
Decrypts a Base64-encoded encrypted text and returns the original plain text.

This implementation uses the OpenSSL library, which is fast, secure, and built into PHP.

  Files folder image Files (1)  
File Role Description
Plain text file CryptoHelper.php Class encrypt and decrypt texts using the AES-256-CBC

The PHP Classes site has supported package installation using the Composer tool since 2013, as you may verify by reading this instructions page.
Install with Composer Install with Composer
 Version Control Unique User Downloads  
 0%
Total:0
This week:0