Encrypt using a symmetric cipher then authenticate using HMAC (SHA-256)

package Default

 Methods

Constructor

__construct(\Zend\Crypt\Symmetric\SymmetricInterface $cipher) 

Parameters

$cipher

\Zend\Crypt\Symmetric\SymmetricInterface

Decrypt

decrypt(string $data) : string | boolean

Parameters

$data

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

stringboolean

Encrypt then authenticate using HMAC

encrypt(string $data) : string

Parameters

$data

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

string

Factory.

factory(string $adapter, array $options = array()) : \Zend\Crypt\BlockCipher
Static

Parameters

$adapter

string

$options

array

Returns

\Zend\Crypt\BlockCipher

Get the value of binary output

getBinaryOutput() : boolean

Returns

boolean

Get symmetric cipher

getCipher() : \Zend\Crypt\Symmetric\SymmetricInterface

Returns

\Zend\Crypt\Symmetric\SymmetricInterface

Get the cipher algorithm

getCipherAlgorithm() : string | boolean

Returns

stringboolean

Get the supported algorithms of the symmetric cipher

getCipherSupportedAlgorithms() : array

Returns

array

Get the hash algorithm for HMAC authentication

getHashAlgorithm() : string

Returns

string

Get the key

getKey() : string

Returns

string

Get the number of iterations for Pbkdf2

getKeyIteration() : integer

Returns

integer

Get the original salt value

getOriginalSalt() : string

Returns

string

Get the Pbkdf2 hash algorithm

getPbkdf2HashAlgorithm() : string

Returns

string

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

getSalt() : string

Returns

string

Returns the symmetric cipher plugin manager. If it doesn't exist it's created.

getSymmetricPluginManager() : \Zend\Crypt\SymmetricPluginManager
Static

Returns

\Zend\Crypt\SymmetricPluginManager

Enable/disable the binary output

setBinaryOutput(boolean $value) : \Zend\Crypt\BlockCipher

Parameters

$value

boolean

Returns

\Zend\Crypt\BlockCipher

Set the symmetric cipher

setCipher(\Zend\Crypt\Symmetric\SymmetricInterface $cipher) : \Zend\Crypt\BlockCipher

Parameters

$cipher

\Zend\Crypt\Symmetric\SymmetricInterface

Returns

\Zend\Crypt\BlockCipher

Set algorithm of the symmetric cipher

setCipherAlgorithm(string $algo) : \Zend\Crypt\BlockCipher

Parameters

$algo

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

\Zend\Crypt\BlockCipher

Set the hash algorithm for HMAC authentication

setHashAlgorithm(string $hash) : \Zend\Crypt\BlockCipher

Parameters

$hash

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

\Zend\Crypt\BlockCipher

Set the encryption/decryption key

setKey(string $key) : \Zend\Crypt\BlockCipher

Parameters

$key

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

\Zend\Crypt\BlockCipher

Set the number of iterations for Pbkdf2

setKeyIteration(integer $num) : \Zend\Crypt\BlockCipher

Parameters

$num

integer

Returns

\Zend\Crypt\BlockCipher

Set the hash algorithm for the Pbkdf2

setPbkdf2HashAlgorithm(string $hash) : \Zend\Crypt\BlockCipher

Parameters

$hash

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

\Zend\Crypt\BlockCipher

Set the salt (IV)

setSalt(string $salt) : \Zend\Crypt\BlockCipher

Parameters

$salt

string

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

Returns

\Zend\Crypt\BlockCipher

Set the symmetric cipher plugin manager

setSymmetricPluginManager(string|\Zend\Crypt\SymmetricPluginManager $plugins) 
Static

Parameters

$plugins

string\Zend\Crypt\SymmetricPluginManager

Exceptions

\Zend\Crypt\Exception\InvalidArgumentException

 Properties

 

The output is binary?

$binaryOutput : boolean

Default

false
 

Symmetric cipher

$cipher : \Zend\Crypt\Symmetric\SymmetricInterface

Default

 

Hash algorithm for HMAC

$hash : string

Default

'sha256'
 

Key

$key : string

Default

 

Number of iterations for Pbkdf2

$keyIteration : string

Default

5000
 

Hash algorithm for Pbkdf2

$pbkdf2Hash : string

Default

'sha256'
 

Check if the salt has been set

$saltSetted : boolean

Default

false
 

Symmetric cipher plugin manager

$symmetricPlugins : \Zend\Crypt\SymmetricPluginManager

Default

null
Static