Encryption
in package
CodeIgniter Encryption Manager
Provides two-way keyed encryption via PHP's Sodium and/or OpenSSL extensions. This class determines the driver, cipher, and mode to use, and then initializes the appropriate encryption handler.
Tags
Table of Contents
Properties
- $digest : string
- HMAC digest to use
- $driver : string
- The driver being used
- $drivers : array<string|int, mixed>
- Map of drivers to handler classes, in preference order
- $encrypter : EncrypterInterface
- The encrypter we create
- $handlers : array<string, bool>
- Handlers that are to be installed
- $hmacKey : string
- The derived HMAC key
- $key : string
- The key/seed being used
Methods
- __construct() : mixed
- __get() : array<string|int, mixed>|string|null
- __get() magic, providing readonly access to some of our protected properties
- __isset() : bool
- __isset() magic, providing checking for some of our protected properties
- createKey() : string
- Create a random key
- initialize() : EncrypterInterface
- Initialize or re-initialize an encrypter
Properties
$digest
HMAC digest to use
protected
string
$digest
= 'SHA512'
$driver
The driver being used
protected
string
$driver
$drivers
Map of drivers to handler classes, in preference order
protected
array<string|int, mixed>
$drivers
= ['OpenSSL', 'Sodium']
$encrypter
The encrypter we create
protected
EncrypterInterface
$encrypter
$handlers
Handlers that are to be installed
protected
array<string, bool>
$handlers
= []
$hmacKey
The derived HMAC key
protected
string
$hmacKey
$key
The key/seed being used
protected
string
$key
Methods
__construct()
public
__construct([Encryption|null $config = null ]) : mixed
Parameters
- $config : Encryption|null = null
Tags
__get()
__get() magic, providing readonly access to some of our protected properties
public
__get(string $key) : array<string|int, mixed>|string|null
Parameters
- $key : string
-
Property name
Return values
array<string|int, mixed>|string|null__isset()
__isset() magic, providing checking for some of our protected properties
public
__isset(string $key) : bool
Parameters
- $key : string
-
Property name
Return values
boolcreateKey()
Create a random key
public
static createKey([int $length = 32 ]) : string
Parameters
- $length : int = 32
-
Output length
Return values
stringinitialize()
Initialize or re-initialize an encrypter
public
initialize([Encryption|null $config = null ]) : EncrypterInterface
Parameters
- $config : Encryption|null = null