Cipher
class Cipher (View source)
Class providing cipher algorithms
Constants
MODE_ECB |
|
MODE_CBC |
|
MODE_CFB |
|
MODE_OFB |
|
MODE_CTR |
|
MODE_GCM |
|
MODE_CCM |
|
MODE_XTS |
|
Methods
Returns cipher algorithms
Finds out whether algorithm exists
Finds out whether the cipher mode is defined in the used OpenSSL library
Cipher magic method for calling static methods
Cipher constructor
Returns cipher algorithm string
Initializes cipher encryption
Updates cipher encryption
Finalizes cipher encryption
Encrypts text to ciphertext
Initializes cipher decryption
Updates cipher decryption
Finalizes cipher decryption
Decrypts ciphertext to decrypted text
Returns cipher block size
Returns cipher key length
Returns cipher IV length
Returns cipher mode
Returns authentication tag
Sets authentication tag
Set authentication tag length
Sets additional application data for authenticated encryption
Details
static string
getAlgorithms(bool $aliases = false, string $prefix = null)
Returns cipher algorithms
static bool
hasAlgorithm(string $algorithm)
Finds out whether algorithm exists
static bool
hasMode(int $mode)
Finds out whether the cipher mode is defined in the used OpenSSL library
static
__callStatic(string $name, array $arguments)
Cipher magic method for calling static methods
__construct(string $algorithm, int $mode = null, string $key_size = null)
Cipher constructor
string
getAlgorithmName()
Returns cipher algorithm string
bool
encryptInit(string $key, string $iv = null)
Initializes cipher encryption
string
encryptUpdate(string $data)
Updates cipher encryption
string
encryptFinish()
Finalizes cipher encryption
string
encrypt(string $data, string $key, string $iv = null)
Encrypts text to ciphertext
null
decryptInit(string $key, string $iv = null)
Initializes cipher decryption
string
decryptUpdate(string $data)
Updates cipher decryption
string
decryptFinish()
Finalizes cipher decryption
string
decrypt(string $data, string $key, string $iv = null)
Decrypts ciphertext to decrypted text
int
getBlockSize()
Returns cipher block size
int
getKeyLength()
Returns cipher key length
int
getIVLength()
Returns cipher IV length
int
getMode()
Returns cipher mode
string
getTag()
Returns authentication tag
bool
setTag(string $tag)
Sets authentication tag
bool
setTagLength(int $tag_length)
Set authentication tag length
bool
setAAD(string $aad)
Sets additional application data for authenticated encryption