2017 © Pedro Peláez
 

library aes-file-encription

PHP AES file encription package

image

assghard/aes-file-encription

PHP AES file encription package

  • Monday, May 7, 2018
  • by assghard
  • Repository
  • 1 Watchers
  • 0 Stars
  • 8 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 1 Versions
  • 14 % Grown

The README.md

PHP7+ AES 256 file encription vendor package

Vendor PHP package. Working on PHP 7+, (*1)

Based on AES File Encryption: https://github.com/philios33/PHP-AES-File-Encryption, (*2)

Installation

composer require assghard/aes-file-encription --prefer-dist, (*3)

How to use

Add library to use: use Assghard\AesFileEncription\FileEncryptionLibrary;, (*4)

Encrypt file:

$encrypted_file = FileEncryptionLibrary::encryptFile($file_to_encrypt, $_PASSWORD); - $file_to_encrypt - relative path to file with filename and extension - $encrypted_file - relative path to encrypted file with filename and extension - $_PASSWORD (optional) - password/key to encryption security, (*5)

Decrypt file:

$decrypted_file = pathinfo($filename)['dirname'].'/'.pathinfo($filename)['filename']; $decryptedFile = FileEncryptionLibrary::decryptFile($encrypted_file, $decrypted_file, $_PASSWORD);, (*6)

  • $encrypted_file - relative path to encrypted file with filename and extension
  • $decrypted_file - relative path to file which will be decrypted with filename and extension
  • $_PASSWORD (optional) - password/key used for encryption
  • $decryptedFile - relative path to decrypted file with original extension
Deprecated functions
  • mcrypt_encrypt: This function has been DEPRECATED as of PHP 7.1.0. Relying on this function is highly discouraged - WORK IN PROGRESS
  • if you have PHP 7.1+ install mcrypt extension. Source: https://gist.github.com/arzzen/1209aa4a430bd95db3090a3399e6c35f

=========================================================, (*7)

Source: PHP AES File Encryption (https://github.com/philios33/php-aes-file-encryption)

PHP implementation of the open source aes crypt file format

File specification is described here https://www.aescrypt.com/aes_file_format.html, (*8)

Introduction

There are many PHP AES implementations available online which offer AES encryption for data streams. It is possible to utilise these low level libraries to encrypt files, but unless you do everything correctly you can end up with an insecure (or broken) library. This library works at a higher level, depending on a low level AES encryption engine (which you can configure), and implementing the open source aes crypt file format., (*9)

Problems

There are many problems to solve when implementing file encryption using a low level library such as mycrpt. Many people incorrectly think you can just encrypt data and shove it in a file. Alas, it is not that simple., (*10)

The open source file format handles many issues such as null bytes trimming, file integrity and fast password checking. It even comes with file extension identifiers which allows arbitrary data to be tagged within the AES file (unencrypted)., (*11)

This library makes it easier for users who are only interested in encrypting and decrypting .aes files with passwords. Other technicalities such as file structure, versions & encryption keys are transparent to the user., (*12)

Compatibility

This library writes version 2 of the file specification defined at https://www.aescrypt.com/aes_file_format.html Backwards compatibility with the older two versions (reading old .aes files) is untested. Output .aes files are fully compatible with any software using the AES Crypt standard file format., (*13)

The Versions

07/05 2018

dev-master

9999999-dev

PHP AES file encription package

  Sources   Download

MIT

The Requires

  • php >=5.4.0

 

by Avatar assghard