Download the PHP package fyre/encryption without Composer
On this page you can find all versions of the php package fyre/encryption. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package encryption
FyreEncryption
FyreEncryption is a free, open-source encryption library for PHP.
Table Of Contents
- Installation
- Basic Usage
- Methods
- Encrypters
- OpenSSL
- Sodium
Installation
Using Composer
In PHP:
Basic Usage
Default configuration options will be resolved from the "Encryption" key in the Config.
Autoloading
It is recommended to bind the EncryptionManager to the Container as a singleton.
Any dependencies will be injected automatically when loading from the Container.
Methods
Build
Build an Encrypter.
$options
is an array containing configuration options.
Container.
Clear
Clear all instances and configs.
Get Config
Get an Encrypter config.
$key
is a string representing the Encrypter key.
Alternatively, if the $key
argument is omitted an array containing all configurations will be returned.
Has Config
Determine whether an Encrypter config exists.
$key
is a string representing the Encrypter key, and will default toEncryptionManager::DEFAULT
.
Is Loaded
Determine whether an Encrypter instance is loaded.
$key
is a string representing the Encrypter key, and will default toEncryptionManager::DEFAULT
.
Set Config
Set the Encrypter config.
$key
is a string representing the Encrypter key.$options
is an array containing configuration options.
Unload
Unload an Encrypter.
$key
is a string representing the Encrypter key, and will default toEncryptionManager::DEFAULT
.
Use
Load a shared Encrypter instance.
$key
is a string representing the Encrypter key, and will default toEncryptionManager::DEFAULT
.
Container.
Encrypters
You can load a specific encrypter by specifying the className
option of the $options
variable above.
Custom encrypters can be created by extending \Fyre\Encryption\Encrypter
, ensuring all below methods are implemented.
Decrypt
Decrypt data.
$data
is the encrypted data.$key
is a string representing the encryption key.
Encrypt
Encrypt data.
$data
is the data to encrypt.$key
is a string representing the encryption key.
Generate Key
Generate an encryption key.
OpenSSL
The OpenSSL encrypter can be loaded using default configuration using the "openssl" key.
You can also load the OpenSSL encrypter using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Encryption\Handlers\OpenSSLEncrypter::class
.cipher
is a string representing the cipher, and will default to "AES-256-CTR".digest
is a string representing the digest, and will default to "SHA512".
Sodium
The Sodium encrypter is the default handler.
You can also load the Sodium encrypter using custom configuration.
$options
is an array containing configuration options.className
must be set to\Fyre\Encryption\Handlers\SodiumEncrypter::class
.blockSize
is a number representing the block size, and will default to 16.digest
is a string representing the digest, and will default to "SHA512".