319. Class

319.1. Zend\Crypt\BlockCipher

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

319.1.1. Methods

319.1.1.1. __construct

__construct()

Constructor

Parameters:SymmetricInterface

319.1.1.2. factory

factory()

Factory.

Parameters:
  • string
  • array
Return type:

BlockCipher

319.1.1.3. getSymmetricPluginManager

getSymmetricPluginManager()

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

Return type:SymmetricPluginManager

319.1.1.4. setSymmetricPluginManager

setSymmetricPluginManager()

Set the symmetric cipher plugin manager

Parameters:string|SymmetricPluginManager
Throws ExceptionInvalidArgumentException:
 

319.1.1.5. setCipher

setCipher()

Set the symmetric cipher

Parameters:SymmetricInterface
Return type:BlockCipher

319.1.1.6. getCipher

getCipher()

Get symmetric cipher

Return type:SymmetricInterface

319.1.1.7. setKeyIteration

setKeyIteration()

Set the number of iterations for Pbkdf2

Parameters:integer
Return type:BlockCipher

319.1.1.8. getKeyIteration

getKeyIteration()

Get the number of iterations for Pbkdf2

Return type:integer

319.1.1.9. setSalt

setSalt()

Set the salt (IV)

Parameters:string
Return type:BlockCipher
Throws :ExceptionInvalidArgumentException

319.1.1.10. getSalt

getSalt()

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

Return type:string

319.1.1.11. getOriginalSalt

getOriginalSalt()

Get the original salt value

Return type:type

319.1.1.12. setBinaryOutput

setBinaryOutput()

Enable/disable the binary output

Parameters:bool
Return type:BlockCipher

319.1.1.13. getBinaryOutput

getBinaryOutput()

Get the value of binary output

Return type:bool

319.1.1.14. setKey

setKey()

Set the encryption/decryption key

Parameters:string
Return type:BlockCipher
Throws :ExceptionInvalidArgumentException

319.1.1.15. getKey

getKey()

Get the key

Return type:string

319.1.1.16. setCipherAlgorithm

setCipherAlgorithm()

Set algorithm of the symmetric cipher

Parameters:string
Return type:BlockCipher
Throws :ExceptionInvalidArgumentException

319.1.1.17. getCipherAlgorithm

getCipherAlgorithm()

Get the cipher algorithm

Return type:string|bool

319.1.1.18. getCipherSupportedAlgorithms

getCipherSupportedAlgorithms()

Get the supported algorithms of the symmetric cipher

Return type:array

319.1.1.19. setHashAlgorithm

setHashAlgorithm()

Set the hash algorithm for HMAC authentication

Parameters:string
Return type:BlockCipher
Throws :ExceptionInvalidArgumentException

319.1.1.20. getHashAlgorithm

getHashAlgorithm()

Get the hash algorithm for HMAC authentication

Return type:string

319.1.1.21. encrypt

encrypt()

Encrypt then authenticate using HMAC

Parameters:string
Return type:string
Throws :ExceptionInvalidArgumentException

319.1.1.22. decrypt

decrypt()

Decrypt

Parameters:string
Return type:string|bool
Throws :ExceptionInvalidArgumentException

319.1.2. Constants

319.1.2.1. KEY_DERIV_HMAC