Download the PHP package bayfrontmedia/encryptor without Composer
On this page you can find all versions of the php package bayfrontmedia/encryptor. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download bayfrontmedia/encryptor
More information about bayfrontmedia/encryptor
Files in bayfrontmedia/encryptor
Package encryptor
Short Description A fast, simple two-way encryption library utilizing OpenSSL.
License MIT
Homepage https://github.com/bayfrontmedia/encryptor
Informations about the package encryptor
Encryptor
A fast, simple two-way encryption library utilizing OpenSSL.
- License
- Author
- Requirements
- Installation
- Usage
License
This project is open source and available under the MIT License.
Author
Requirements
- PHP
^8.0
(Tested up to8.4
) - OpenSSL PHP extension
- JSON PHP extension
Installation
Usage
Start using Encryptor
A private, reproducible key must be passed to the constructor. The same key must be used when encrypting and decrypting. If the key used to encrypt a value is lost, it will not be able to be decrypted.
An optional second constructor parameter allows you to specify which cipher method to use.
By default, Encryptor uses AES-256-CBC
.
If an invalid cipher method is used, a Bayfront\Encryptor\InvalidCipherException
exception will be thrown.
Public methods
- getKey
- getCipher
- encrypt
- encryptString
- decrypt
- decryptString
getKey
Description:
Returns the encryption key.
Parameters:
- None
Returns:
- (string)
getCipher
Description:
Returns the cipher method used for encryption.
Parameters:
- None
Returns:
- (string)
encrypt
Description:
Encrypts a given value.
Parameters:
$value
(mixed)$serialize = true
(bool)
Returns:
- (string)
Throws:
Bayfront\Encryptor\EncryptException
Example:
encryptString
Description:
Encrypts a string without serialization.
Parameters:
$value
(string)
Returns:
- (string)
Throws:
Bayfront\Encryptor\EncryptException
Example:
decrypt
Description:
Decrypts a given value.
Parameters:
$data
(string)$unserialize = true
(bool)
Returns:
- (mixed)
Throws:
Bayfront\Encryptor\DecryptException
Example:
decryptString
Description:
Decrypts a string without unserialization.
Parameters:
$data
(string)
Returns:
- (string)
Throws:
Bayfront\Encryptor\DecryptException
Example:
All versions of encryptor with dependencies
ext-openssl Version *
ext-json Version *