Zend\Crypt\Symmetric\Mcrypt
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!
Synopsis
class Mcrypt
implements
SymmetricInterface
{
- // constants
- const DEFAULT_PADDING = 'pkcs7';
- // members
- protected string $key;
- protected string $iv;
- protected string $algo;
- protected string $mode;
- protected PaddingInterface $padding;
- protected PaddingPluginManager $paddingPlugins;
- protected array $supportedAlgos;
- protected array $supportedModes;
- // methods
- public void __construct()
- protected void setDefaultOptions()
- public static PaddingPluginManager getPaddingPluginManager()
- public static void setPaddingPluginManager()
- public int getKeySize()
- public Mcrypt setKey()
- public string getKey()
- public Mcrypt setAlgorithm()
- public string getAlgorithm()
- public Mcrypt setPadding()
- public PaddingInterface getPadding()
- public string encrypt()
- public string decrypt()
- public int getSaltSize()
- public array getSupportedAlgorithms()
- public Mcrypt setSalt()
- public string getSalt()
- public string getOriginalSalt()
- public Mcrypt setMode()
- public string getMode()
- public array getSupportedModes()
- public int getBlockSize()
Hierarchy
Implements
Constants
Name | Value |
---|---|
DEFAULT_PADDING | 'pkcs7' |
Members
protected
- $algo
—
string
Encryption algorithm - $iv
—
string
IV - $key
—
string
Key - $mode
—
string
Encryption mode - $padding
—
Zend\Crypt\Symmetric\Padding\PaddingInterface
Padding - $paddingPlugins
—
Zend\Crypt\Symmetric\PaddingPluginManager
Padding plugins - $supportedAlgos
—
array
Supported cipher algorithms - $supportedModes
—
array
Supported encryption modes
Methods
protected
- setDefaultOptions() — Set default options
public
- __construct() — Constructor
- decrypt() — Decrypt
- encrypt() — Encrypt
- getAlgorithm() — Get the encryption algorithm
- getBlockSize() — Get the block size
- getKey() — Get the encryption key
- getKeySize() — Get the maximum key size for the selected cipher and mode of operation
- getMode() — Get the cipher mode
- getOriginalSalt() — Get the original salt value
- getPadding() — Get the padding object
- getPaddingPluginManager() — Returns the padding plugin manager. If it doesn't exist it's created.
- getSalt() — Get the salt (IV) according to the size requested by the algorithm
- getSaltSize() — Get the salt (IV) size
- getSupportedAlgorithms() — Get the supported algorithms
- getSupportedModes() — Get all supported encryption modes
- setAlgorithm() — Set the encryption algorithm (cipher)
- setKey() — Set the encryption key If the key is longer than maximum supported, it will be truncated by getKey().
- setMode() — Set the cipher mode
- setPadding() — Set the padding object
- setPaddingPluginManager() — Set the padding plugin manager
- setSalt() — Set the salt (IV)