Zend Framework
3.0
|
Encrypt/decrypt a file using a symmetric cipher in CBC mode then authenticate using HMAC. More...
Public Member Functions | |
__construct (Symmetric\SymmetricInterface $cipher=null) | |
Constructor. | |
setCipher (Symmetric\SymmetricInterface $cipher) | |
Set the cipher object. | |
getCipher () | |
Get the cipher object. | |
setKeyIteration ($num) | |
Set the number of iterations for Pbkdf2. | |
getKeyIteration () | |
Get the number of iterations for Pbkdf2. | |
setKey ($key) | |
Set the encryption/decryption key. | |
getKey () | |
Get the key. | |
setCipherAlgorithm ($algo) | |
Set algorithm of the symmetric cipher. | |
getCipherAlgorithm () | |
Get the cipher algorithm. | |
getCipherSupportedAlgorithms () | |
Get the supported algorithms of the symmetric cipher. | |
setHashAlgorithm ($hash) | |
Set the hash algorithm for HMAC authentication. | |
getHashAlgorithm () | |
Get the hash algorithm for HMAC authentication. | |
setPbkdf2HashAlgorithm ($hash) | |
Set the hash algorithm for the Pbkdf2. | |
getPbkdf2HashAlgorithm () | |
Get the Pbkdf2 hash algorithm. | |
encrypt ($fileIn, $fileOut) | |
Encrypt then authenticate a file using HMAC. | |
decrypt ($fileIn, $fileOut) | |
Decrypt a file. | |
Public Attributes | |
const | BUFFER_SIZE = 1048576 |
Protected Member Functions | |
checkFileInOut ($fileIn, $fileOut) | |
Check that input file exists and output file dont. | |
Protected Attributes | |
$pbkdf2Hash = 'sha256' | |
$hash = 'sha256' | |
$keyIteration = 10000 | |
$key | |
$cipher | |
Encrypt/decrypt a file using a symmetric cipher in CBC mode then authenticate using HMAC.
__construct | ( | Symmetric\SymmetricInterface | $cipher = null | ) |
Constructor.
SymmetricInterface | $cipher |
|
protected |
Check that input file exists and output file dont.
string | $fileIn | |
string | $fileOut |
Exception\InvalidArgumentException |
decrypt | ( | $fileIn, | |
$fileOut | |||
) |
Decrypt a file.
string | $fileIn | |
string | $fileOut | |
bool | $compress |
Exception\InvalidArgumentException |
encrypt | ( | $fileIn, | |
$fileOut | |||
) |
Encrypt then authenticate a file using HMAC.
string | $fileIn | |
string | $fileOut |
Exception\InvalidArgumentException |
getCipher | ( | ) |
Get the cipher object.
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.
getPbkdf2HashAlgorithm | ( | ) |
Get the Pbkdf2 hash algorithm.
setCipher | ( | Symmetric\SymmetricInterface | $cipher | ) |
Set the cipher object.
SymmetricInterface | $cipher |
setCipherAlgorithm | ( | $algo | ) |
Set algorithm of the symmetric cipher.
string | $algo |
setHashAlgorithm | ( | $hash | ) |
Set the hash algorithm for HMAC authentication.
string | $hash |
Exception\InvalidArgumentException |
setKey | ( | $key | ) |
Set the encryption/decryption key.
string | $key |
Exception\InvalidArgumentException |
setKeyIteration | ( | $num | ) |
Set the number of iterations for Pbkdf2.
int | $num |
setPbkdf2HashAlgorithm | ( | $hash | ) |
Set the hash algorithm for the Pbkdf2.
string | $hash |
Exception\InvalidArgumentException |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
const BUFFER_SIZE = 1048576 |