Zend\Crypt\BlockCipher
Encrypt using a symmetric cipher then authenticate using HMAC (SHA-256)
Synopsis
class BlockCipher
{
- // members
- protected string $pbkdf2Hash;
- protected SymmetricInterface $cipher;
- protected SymmetricPluginManager $symmetricPlugins;
- protected string $hash;
- protected bool $saltSetted;
- protected bool $binaryOutput;
- protected integer $keyIteration;
- protected string $key;
- // methods
- public void __construct()
- public static BlockCipher factory()
- public static SymmetricPluginManager getSymmetricPluginManager()
- public static void setSymmetricPluginManager()
- public BlockCipher setCipher()
- public SymmetricInterface getCipher()
- public BlockCipher setKeyIteration()
- public int getKeyIteration()
- public BlockCipher setSalt()
- public string getSalt()
- public string getOriginalSalt()
- public BlockCipher setBinaryOutput()
- public bool getBinaryOutput()
- public BlockCipher setKey()
- public string getKey()
- public BlockCipher setCipherAlgorithm()
- public string|bool getCipherAlgorithm()
- public array getCipherSupportedAlgorithms()
- public BlockCipher setHashAlgorithm()
- public string getHashAlgorithm()
- public BlockCipher setPbkdf2HashAlgorithm()
- public string getPbkdf2HashAlgorithm()
- public string encrypt()
- public string|bool decrypt()
Members
protected
- $binaryOutput
—
Zend\Crypt\bool
The output is binary? - $cipher
—
Zend\Crypt\Symmetric\SymmetricInterface
Symmetric cipher - $hash
—
string
Hash algorithm for HMAC - $key
—
string
Key - $keyIteration
—
string
Number of iterations for Pbkdf2 - $pbkdf2Hash
—
string
Hash algorithm for Pbkdf2 - $saltSetted
—
Zend\Crypt\bool
Check if the salt has been set - $symmetricPlugins
—
Zend\Crypt\SymmetricPluginManager
Symmetric cipher plugin manager
Methods
public
- __construct() — Constructor
- decrypt() — Decrypt
- encrypt() — Encrypt then authenticate using HMAC
- factory() — Factory.
- getBinaryOutput() — Get the value of binary output
- getCipher() — Get symmetric cipher
- getCipherAlgorithm() — Get the cipher algorithm
- getCipherSupportedAlgorithms() — Get the supported algorithms of the symmetric cipher
- getHashAlgorithm() — Get the hash algorithm for HMAC authentication
- getKey() — Get the key
- getKeyIteration() — Get the number of iterations for Pbkdf2
- getOriginalSalt() — Get the original salt value
- getPbkdf2HashAlgorithm() — Get the Pbkdf2 hash algorithm
- getSalt() — Get the salt (IV) according to the size requested by the algorithm
- getSymmetricPluginManager() — Returns the symmetric cipher plugin manager. If it doesn't exist it's created.
- setBinaryOutput() — Enable/disable the binary output
- setCipher() — Set the symmetric cipher
- setCipherAlgorithm() — Set algorithm of the symmetric cipher
- setHashAlgorithm() — Set the hash algorithm for HMAC authentication
- setKey() — Set the encryption/decryption key
- setKeyIteration() — Set the number of iterations for Pbkdf2
- setPbkdf2HashAlgorithm() — Set the hash algorithm for the Pbkdf2
- setSalt() — Set the salt (IV)
- setSymmetricPluginManager() — Set the symmetric cipher plugin manager