|
| __construct (CipherEnum $cipher, ModeEnum $mode, PaddingInterface $padding, $key, $tagLength=self::DEFAULT_TAG_LENGTH) |
|
| decrypt ($iv, $data, $tag=null, $aad= '') |
|
| encrypt ($iv, $data, &$tag=null, $aad= '') |
|
| getBlockSize () |
|
| getCipher () |
|
| getIVSize () |
|
| getKey () |
|
|
const | SIGMA1 = "\xA0\x9E\x66\x7F\x3B\xCC\x90\x8B" |
| Sigma1 constant (from the RFC)
|
|
const | SIGMA2 = "\xB6\x7A\xE8\x58\x4C\xAA\x73\xB2" |
| Sigma2 constant (from the RFC)
|
|
const | SIGMA3 = "\xC6\xEF\x37\x2F\xE9\x4F\x82\xBE" |
| Sigma3 constant (from the RFC)
|
|
const | SIGMA4 = "\x54\xFF\x53\xA5\xF1\xD3\x6F\x1C" |
| Sigma4 constant (from the RFC)
|
|
const | SIGMA5 = "\x10\xE5\x27\xFA\xDE\x68\x2D\x1D" |
| Sigma5 constant (from the RFC)
|
|
const | SIGMA6 = "\xB0\x56\x88\xC2\xB3\xE6\xC1\xFD" |
| Sigma6 constant (from the RFC)
|
|
const | DEFAULT_TAG_LENGTH = 16 |
|
|
static | fl ($FL_IN, $KE) |
|
static | flinv ($FLINV_IN, $KE) |
|
static | rotateLeft ($value, $n) |
|
static | sbox ($n, $x) |
|
|
| $cipher |
|
| $k |
| Subkeys used for encryption.
|
|
| $k2 |
| Subkeys used for decryption.
|
|
| $ke |
| Subkeys used by the Feistel structure during encryption.
|
|
| $ke2 |
| Subkeys used by the Feistel structure during decryption.
|
|
| $key |
|
| $keyLength |
| Original key length in bits (128, 192 or 256)
|
|
| $kw |
| Subkeys used for whitening during encryption.
|
|
| $kw2 |
| Subkeys used for whitening during decryption.
|
|
|
static | $sbox1 = null |
| Character string containing the whole sbox1 crypto-box.
|
|
Camellia cipher (RFC 3713).
- See also
- https://tools.ietf.org/html/rfc3713
Definition at line 20 of file Camellia.php.
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::decrypt |
( |
|
$iv, |
|
|
|
$data, |
|
|
|
$tag = null , |
|
|
|
$aad = '' |
|
) |
| |
Decrypt some data.
- Parameters
-
string | $iv | Initialization Vector for the operation. |
string | $data | Data to decrypt. |
string | $tag | Authentication tag. |
string | $aad | Additional authenticated data. |
- Return values
-
string | Plaintext (decrypted data). |
- Note
- The $iv parameter is unused for some modes of operations (namely
MODE_ECB
). Still, this parameter is mandatory and an empty string may be passed for those modes.
-
An exception is thrown in case decryption fails, or the given authentication tag is incorrect (AEAD-only).
-
The $aad & $tag parameters are unused unless the required mode supports Authenticated Encryption with Additional Data (AEAD).
MODE_GCM
& MODE_EAX
are known to support AEAD.
Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 456 of file Camellia.php.
References fpoirotte\Cryptal\DefaultAlgorithms\Camellia\getBlockSize(), and fpoirotte\Cryptal\DefaultAlgorithms\Camellia\xcrypt().
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::encrypt |
( |
|
$iv, |
|
|
|
$data, |
|
|
& |
$tag = null , |
|
|
|
$aad = '' |
|
) |
| |
Encrypt some data.
- Parameters
-
string | $iv | Initialization Vector for the operation. |
string | $data | Data to encrypt. |
string | $tag | Variable where the generated tag will be stored. |
string | $aad | Additional authenticated data. |
- Return values
-
string | Ciphertext (encrypted data). |
- Note
- The $iv parameter is unused for some modes of operations (namely
MODE_ECB
). Still, this parameter is mandatory and an empty string may be passed for those modes.
-
An exception is thrown in case encryption fails.
-
The $aad & $tag parameters are unused unless the required mode supports Authenticated Encryption with Additional Data (AEAD).
MODE_GCM
& MODE_EAX
are known to support AEAD.
Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 442 of file Camellia.php.
References fpoirotte\Cryptal\DefaultAlgorithms\Camellia\getBlockSize(), and fpoirotte\Cryptal\DefaultAlgorithms\Camellia\xcrypt().
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::f |
( |
|
$F_IN, |
|
|
|
$KE |
|
) |
| |
|
protected |
F-function (per RFC 3713)
- Parameters
-
string | $F_IN | 64-bit input data for the function |
string | $KE | 64-bit subkey |
- Return values
-
Definition at line 311 of file Camellia.php.
static fpoirotte\Cryptal\DefaultAlgorithms\Camellia::fl |
( |
|
$FL_IN, |
|
|
|
$KE |
|
) |
| |
|
staticprotected |
static fpoirotte\Cryptal\DefaultAlgorithms\Camellia::flinv |
( |
|
$FLINV_IN, |
|
|
|
$KE |
|
) |
| |
|
staticprotected |
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::getBlockSize |
( |
| ) |
|
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::getCipher |
( |
| ) |
|
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::getIVSize |
( |
| ) |
|
Get the size of the Initialization Vector, in bytes.
- Return values
-
int | Required size for the Initialization Vector. Might be zero in case the given cipher/mode combination does not require an initialization vector. |
Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 470 of file Camellia.php.
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::getKey |
( |
| ) |
|
static fpoirotte\Cryptal\DefaultAlgorithms\Camellia::rotateLeft |
( |
|
$value, |
|
|
|
$n |
|
) |
| |
|
staticprotected |
Perform a left rotation operation.
- Parameters
-
string | $value | Big-endian string whose bits will be left-rotated |
int | $n | Number of bits to rotate to the left |
- Return values
-
string | The result from rotating $n bits from $value |
Definition at line 126 of file Camellia.php.
static fpoirotte\Cryptal\DefaultAlgorithms\Camellia::sbox |
( |
|
$n, |
|
|
|
$x |
|
) |
| |
|
staticprotected |
Retrieve the sbox value at a given index.
- Parameters
-
int | $n | A number between 1 and 4 indicating the sbox from which the resulting value will be taken. |
string | $x | A single character indicating the index in the sbox whose value should be returned. |
- Return values
-
string | A single character: the value for the given sbox and index. |
Definition at line 286 of file Camellia.php.
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::scheduleKeys |
( |
|
$key | ) |
|
|
protected |
fpoirotte\Cryptal\DefaultAlgorithms\Camellia::xcrypt |
( |
|
$m, |
|
|
array |
$k, |
|
|
array |
$ke, |
|
|
array |
$kw |
|
) |
| |
|
protected |
The documentation for this class was generated from the following file: