\CryptoManana\Core\Traits\MessageEncryptionFileEncryptionTrait

Trait FileEncryptionTrait - Reusable implementation of `FileEncryptionInterface`.

Summary

Methods
Properties
Constants
encryptFile()
decryptFile()
No public properties found
No constants found
validateFileNamePath()
No protected properties found
N/A
No private methods found
No private properties found
N/A

Methods

encryptFile()

encryptFile(string  $filename) : string

Encrypts the content of a given plain file.

Parameters

string $filename

The full path and name of the file for encryption.

Throws

\Exception

Validation errors.

Returns

string —

The encrypted file content.

decryptFile()

decryptFile(string  $filename) : string

Decrypts the content of a given encrypted file.

Parameters

string $filename

The full path and name of the file for encryption.

Throws

\Exception

Validation errors.

Returns

string —

The decrypted file content.

validateFileNamePath()

validateFileNamePath(string  $filename) 

Internal method for location and filename validation.

Parameters

string $filename

The filename and location.

Throws

\Exception

Validation errors.