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
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.

Details

OpenSSL File Encrypt

Simple symmetric file encryption.

Purpose

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

Example

Encrypt

    php cmdline_example.php -e abc.txt

results in the encrypted file abc.txt.osl

Decrypt

    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.

License

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)
 
  Groups   Applications   Files Files  

  Groups  
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


  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 README.md 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 openssl-file-encrypt.zip
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.