Symmetric encryption using the Mcrypt extension

NOTE: DO NOT USE only this class to encrypt data. This class doesn't provide authentication and integrity check over the data. PLEASE USE Zend\Crypt\BlockCipher instead!

 Methods

Constructor

__construct(array | \Traversable $options) 

Decrypt

decrypt(string $data) : string

Parameters

$data

string

Exceptions

\Zend\Crypt\Symmetric\Exception\InvalidArgumentException

Returns

string

Encrypt

encrypt(string $data) : string

Parameters

$data

string

Exceptions

\Zend\Crypt\Symmetric\Exception\InvalidArgumentException

Returns

string

Get the encryption algorithm

getAlgorithm() : string

Returns

string

Get the block size

getBlockSize() : int

Returns

int

Get the encryption key

getKey() : string

Returns

string

Get the maximum key size for the selected cipher and mode of operation

getKeySize() : int

Returns

int

Get the cipher mode

getMode() : string

Returns

string

Get the original salt value

getOriginalSalt() : string

Returns

string

Returns the padding plugin manager.

getPaddingPluginManager() : \Zend\Crypt\Symmetric\PaddingPluginManager

If it doesn't exist it's created.

Returns

Get the salt (IV) according to the size requested by the algorithm

getSalt() : string

Returns

string

Get the salt (IV) size

getSaltSize() : int

Returns

int

Get the supported algorithms

getSupportedAlgorithms() : array

Returns

array

Get all supported encryption modes

getSupportedModes() : array

Returns

array

Set the encryption algorithm (cipher)

setAlgorithm(string $algo) : \Zend\Crypt\Symmetric\Mcrypt

Set the encryption key If the key is longer than maximum supported, it will be truncated by getKey().

setKey(string $key) : \Zend\Crypt\Symmetric\Mcrypt

Set the cipher mode

setMode(string $mode) : \Zend\Crypt\Symmetric\Mcrypt

Set the padding object

setPadding(\Zend\Crypt\Symmetric\Padding\PaddingInterface $padding) : \Zend\Crypt\Symmetric\Mcrypt

Set the padding plugin manager

setPaddingPluginManager(string | \Zend\Crypt\Symmetric\PaddingPluginManager $plugins) : void

Set the salt (IV)

setSalt(string $salt) : \Zend\Crypt\Symmetric\Mcrypt

Set default options

setDefaultOptions(array $options) : void

Parameters

$options

array

 Properties

 

Encryption algorithm

$algo : string

 

IV

$iv : string

 

Key

$key : string

 

Encryption mode

$mode : string

   

Padding plugins

$paddingPlugins : \Zend\Crypt\Symmetric\PaddingPluginManager

 

Supported cipher algorithms

$supportedAlgos : array

 

Supported encryption modes

$supportedModes : array

 Constants

 

DEFAULT_PADDING

DEFAULT_PADDING