Properties

$authenticationMode

$authenticationMode : integer

The authenticated encryption mode operation property.

Type

integer — The authenticated encryption mode integer code value.

Methods

setKeyedDigestionFunction()

setKeyedDigestionFunction(\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyedHashFunction  $hasher) : $this

Setter for the keyed message digestion service.

Parameters

\CryptoManana\Core\Abstractions\MessageDigestion\AbstractKeyedHashFunction $hasher

The keyed message digestion service or null.

Returns

$this —

The container object.

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\AbstractKeyedHashFunction|null  $hasher = null) 

Container constructor.

Parameters

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

the message symmetric encryption service.

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

The message keyed digestion service.

Throws

\Exception

Initialization validation.

__destruct()

__destruct() 

Container destructor.

__clone()

__clone() 

Container cloning via deep copy.

setAuthenticationMode()

setAuthenticationMode(integer  $mode) : $this

Setter for authenticated encryption mode operation property.

Parameters

integer $mode

The authenticated encryption mode integer code value.

Throws

\Exception

Validation errors.

Returns

$this —

The authenticated encryption object.

getAuthenticationMode()

getAuthenticationMode() : integer

Getter for the authenticated encryption mode operation property.

Returns

integer —

The authenticated encryption mode integer code value.

authenticatedEncryptData()

authenticatedEncryptData(string  $plainData) : \CryptoManana\DataStructures\AuthenticatedCipherData

Encrypts and authenticates the given plain data.

Parameters

string $plainData

The plain input string.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\AuthenticatedCipherData

The authenticated cipher data object.

authenticatedDecryptData()

authenticatedDecryptData(\CryptoManana\DataStructures\AuthenticatedCipherData  $authenticatedCipherData) : string

Decrypts and authenticates the given cipher data.

Parameters

\CryptoManana\DataStructures\AuthenticatedCipherData $authenticatedCipherData

The authenticated cipher data object.

Throws

\Exception

Validation errors.

Returns

string —

The plain data information.

injectMacIntoMessageData()

injectMacIntoMessageData(string  $plainData, string  $macTag) : string

Internal method for the injection of a MAC tag inside a plain message.

Parameters

string $plainData

The plain input string.

string $macTag

The message authentication code (tag).

Returns

string —

The plain message containing the MAC tag inside.

extractConcatenatedMacFromMessageData()

extractConcatenatedMacFromMessageData(string  $plainData) : array

Internal method for the extraction of a MAC tag contained inside a plain message.

Parameters

string $plainData

The plain input string.

Returns

array —

The separated message data and MAC tag as a tuple/array representation.

getMutualKeyCombinationWithSavingPreviousState()

getMutualKeyCombinationWithSavingPreviousState() : array

Builds a mutual key configuration with preserving the original/previous configuration state.

Returns

array —

The mutual keys and the original keys configuration as a tuple/array representation.

encryptAndMac()

encryptAndMac(string  $plainData) : \CryptoManana\DataStructures\AuthenticatedCipherData

Encrypts and authenticates the given plain data in Encrypt-and-MAC (E&M) mode.

Parameters

string $plainData

The plain input string.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\AuthenticatedCipherData

The authenticated cipher data object.

decryptAndMac()

decryptAndMac(\CryptoManana\DataStructures\AuthenticatedCipherData  $authenticatedCipherData) : string

Decrypts and authenticates the given plain data in Encrypt-and-MAC (E&M) mode.

Parameters

\CryptoManana\DataStructures\AuthenticatedCipherData $authenticatedCipherData

The authenticated cipher data object.

Throws

\Exception

Validation or authentication errors.

Returns

string —

The plain data information.

macThenEncrypt()

macThenEncrypt(string  $plainData) : \CryptoManana\DataStructures\AuthenticatedCipherData

Encrypts and authenticates the given plain data in MAC-then-Encrypt (MtE) mode.

Parameters

string $plainData

The plain input string.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\AuthenticatedCipherData

The authenticated cipher data object.

macThenDecrypt()

macThenDecrypt(\CryptoManana\DataStructures\AuthenticatedCipherData  $authenticatedCipherData) : string

Decrypts and authenticates the given plain data in MAC-then-Encrypt (MtE) mode.

Parameters

\CryptoManana\DataStructures\AuthenticatedCipherData $authenticatedCipherData

The authenticated cipher data object.

Throws

\Exception

Validation or authentication errors.

Returns

string —

The plain data information.

encryptThenMac()

encryptThenMac(string  $plainData) : \CryptoManana\DataStructures\AuthenticatedCipherData

Encrypts and authenticates the given plain data in Encrypt-then-MAC (EtM) mode.

Parameters

string $plainData

The plain input string.

Throws

\Exception

Validation errors.

Returns

\CryptoManana\DataStructures\AuthenticatedCipherData

The authenticated cipher data object.

decryptThenMac()

decryptThenMac(\CryptoManana\DataStructures\AuthenticatedCipherData  $authenticatedCipherData) : string

Decrypts and authenticates the given plain data in Encrypt-then-MAC (EtM) mode.

Parameters

\CryptoManana\DataStructures\AuthenticatedCipherData $authenticatedCipherData

The authenticated cipher data object.

Throws

\Exception

Validation or authentication errors.

Returns

string —

The plain data information.