PHP Classes

PHP OpenSSL Encrypt and Decrypt File: Encrypt and decrypt file data using OpenSSL

Recommend this page to a friend!

  Author Author  
Picture of Martin Latter
Name: Martin Latter <contact>
Classes: 8 packages by
Country: United Kingdom
Age: ???
All time rank: 132161 in United Kingdom
Week rank: 164 Up6 in United Kingdom Up
Innovation award
Innovation award
Nominee: 5x

  Detailed description   Download Download .zip .tar.gz   Install with Composer Install with Composer  
This class can encrypt and decrypt file data using OpenSSL.

It takes a given password and encrypts data read from a file using the OpenSSL extension.

The class can also decrypt previously encrypted files using the same password.


OpenSSL File Encrypt

Simple symmetric file encryption.


Provide strong file encryption using OpenSSL, via an easy-to-use PHP wrapper.

One use is to avoid direct OpenSSL interaction, such as:

    openssl enc -e -aes-256-cbc -in abc.txt -out abc.enc -k password -S deadbeef

and offer something simpler:

    php cmdline_example.php -e abc.txt



    php cmdline_example.php -e abc.txt

results in the encrypted file abc.txt.osl


    php cmdline_example.php -d abc.txt.osl

results in abc.txt, with the correct password

-- and overwrites the original file abc.txt if it is present in the same directory.

Max File Size

The maximum file size that can be processed is approximately 1.8GB.

This limit is seemingly dictated by the PHP openssl module (OpenSSL itself on the command-line will process 2GB+ files).

Low Memory Systems

A file-chunking version for limited memory availability works with the non-counter (CTR) mode ciphers.

Appending the HMAC to the final file and decrypting successfully is not yet ready.


OpenSSL File Encrypt is released under the GPL v.3.

  Classes of Martin Latter  >  PHP OpenSSL Encrypt and Decrypt File  >  Download Download .zip .tar.gz  >  Support forum Support forum  >  Blog Blog  >  RSS 1.0 feed RSS 2.0 feed Latest changes  
Name: PHP OpenSSL Encrypt and Decrypt File
Base name: openssl-file-encrypt
Description: Encrypt and decrypt file data using OpenSSL
Version: 0.05
PHP version: 7.0
License: GNU General Public License (GPL)
All time users: 293 users
All time rank: 7434
Week users: 1 user
Week rank: 154 Up
  Groups   Rate classes User ratings   Applications   Files Files  

Group folder image PHP 5 Classes using PHP 5 specific features View top rated classes
Group folder image Cryptography Encrypting, decrypting and hashing data View top rated classes

  User ratings  
Not yet rated by the users

  Applications that use this package  
No pages of applications that use this class were specified.

Add link image If you know an application of this package, send a message to the author to add a link here.

  Files folder image Files  
File Role Description
Files folder imageclasses (1 file)
Files folder imagefile_examples (1 file)
Accessible without login Plain text file cmdline_example.php Example Example script
Accessible without login Plain text file LICENSE Lic. License text
Accessible without login Plain text file Doc. Documentation

  Files folder image Files  /  classes  
File Role Description
  Plain text file openssl_file.class.php Class Class source

  Files folder image Files  /  file_examples  
File Role Description
  Accessible without login Plain text file test_text.txt Doc. Documentation

Install with Composer Install with Composer - Download Download all files: openssl-file-encrypt.tar.gz
NOTICE: if you are using a download manager program like 'GetRight', please Login before trying to download this archive.
For more information send a message to info at phpclasses dot org.