\CryptoManana\Core\Interfaces\ContainersAuthenticatedEncryptionInterface

Interface AuthenticatedEncryptionInterface - Interface specification for authenticated encryption.

Summary

Methods
Constants
setAuthenticationMode()
getAuthenticationMode()
authenticatedEncryptData()
authenticatedDecryptData()
AUTHENTICATION_MODE_ENCRYPT_AND_MAC
AUTHENTICATION_MODE_MAC_THEN_ENCRYPT
AUTHENTICATION_MODE_ENCRYPT_THEN_MAC
No protected methods found
N/A
No private methods found
N/A

Constants

AUTHENTICATION_MODE_ENCRYPT_AND_MAC

AUTHENTICATION_MODE_ENCRYPT_AND_MAC

The Encrypt-and-MAC (E&M) authenticated encryption mode representation.

AUTHENTICATION_MODE_MAC_THEN_ENCRYPT

AUTHENTICATION_MODE_MAC_THEN_ENCRYPT

The MAC-then-Encrypt (MtE) authenticated encryption mode representation.

AUTHENTICATION_MODE_ENCRYPT_THEN_MAC

AUTHENTICATION_MODE_ENCRYPT_THEN_MAC

The Encrypt-then-MAC (EtM) authenticated encryption mode representation.

Methods

setAuthenticationMode()

setAuthenticationMode(integer  $mode) 

Setter for authenticated encryption mode operation property.

Parameters

integer $mode

The authenticated encryption mode integer code value.

Throws

\Exception

Validation errors.

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.