CodeIgniter v4.7 API

KeyRotationDecorator
in package
implements EncrypterInterface

Key Rotation Decorator

Wraps any EncrypterInterface implementation to provide automatic fallback to previous encryption keys during decryption. This enables seamless key rotation without requiring re-encryption of existing data.

Table of Contents

Interfaces

EncrypterInterface
CodeIgniter Encryption Handler

Properties

$innerHandler  : EncrypterInterface
$previousKeys  : array<string|int, mixed>

Methods

__construct()  : mixed
__get()  : array<string|int, mixed>|bool|int|string|null
Delegate property access to the inner handler.
__isset()  : bool
Delegate property existence check to inner handler.
decrypt()  : string
Decrypt - convert ciphertext into plaintext
encrypt()  : string
Encrypt - convert plaintext into ciphertext

Properties

Methods

__get()

Delegate property access to the inner handler.

public __get(string $key) : array<string|int, mixed>|bool|int|string|null
Parameters
$key : string
Return values
array<string|int, mixed>|bool|int|string|null

__isset()

Delegate property existence check to inner handler.

public __isset(string $key) : bool
Parameters
$key : string
Return values
bool

decrypt()

Decrypt - convert ciphertext into plaintext

public decrypt(mixed $data[, mixed $params = null ]) : string

Attempts decryption with current key first. If that fails and no explicit key was provided in $params, tries each previous key.

Parameters
$data : mixed

Encrypted data

$params : mixed = null

Overridden parameters, specifically the key

Tags
throws
EncryptionException
Return values
string

encrypt()

Encrypt - convert plaintext into ciphertext

public encrypt(mixed $data[, mixed $params = null ]) : string

Encryption always uses the inner handler's current key.

Parameters
$data : mixed

Input data

$params : mixed = null

Overridden parameters, specifically the key

Return values
string

        
On this page

Search results