Properties

Methods

setSymmetricCipher()

setSymmetricCipher(\CryptoManana\Core\Abstractions\MessageEncryption\AbstractBlockCipherAlgorithm|\CryptoManana\Core\Interfaces\MessageEncryption\DataEncryptionInterface  $cipher) : $this

Setter for the message symmetric encryption service.

Parameters

\CryptoManana\Core\Abstractions\MessageEncryption\AbstractBlockCipherAlgorithm|\CryptoManana\Core\Interfaces\MessageEncryption\DataEncryptionInterface $cipher

The message symmetric encryption service.

Returns

$this —

The container object.

__construct()

__construct(\CryptoManana\Core\Abstractions\MessageEncryption\AbstractBlockCipherAlgorithm|null  $cipher = null, \CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction|null  $hasher = null) 

Container constructor.

Parameters

\CryptoManana\Core\Abstractions\MessageEncryption\AbstractBlockCipherAlgorithm|null $cipher

the message symmetric encryption service.

\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyMaterialDerivationFunction|null $hasher

The key expansion derivation service.

Throws

\Exception

Initialization validation.

__destruct()

__destruct() 

Container destructor.

__clone()

__clone() 

Container cloning via deep copy.

multipleEncryptData()

multipleEncryptData(string  $plainData, integer  $iterations = 2) : string

Encrypts the given plain data multiple times with different extracted keys.

Parameters

string $plainData

The plain input string.

integer $iterations

The number of internal iterations to perform.

Throws

\Exception

Validation errors.

Returns

string —

The cipher/encrypted data.

multipleDecryptData()

multipleDecryptData(string  $cipherData, integer  $iterations = 2) : string

Decrypts the given cipher data multiple times with different extracted keys.

Parameters

string $cipherData

The encrypted input string.

integer $iterations

The number of internal iterations to perform.

Throws

\Exception

Validation errors.

Returns

string —

The decrypted/plain data.

validateIterationsNumber()

validateIterationsNumber(integer  $iterations) 

Internal method for integer internal iteration count validation.

Parameters

integer $iterations

The number of internal iterations to perform.

Throws

\Exception

Validation errors.

generateProcessingConfiguration()

generateProcessingConfiguration(integer  $iterations, boolean|integer|null  $direction = true) : array

Internal method for generating a list of secret keys and initialization vectors.

Parameters

integer $iterations

The number of internal iterations to perform.

boolean|integer|null $direction

Flag for encryption direction (encrypt => true or decrypt => false).

Throws

\Exception

Key expansion service errors.

Returns

array —

The list of keys and IVs.