cryptal
latest
Cryptography Abstraction Layer
|
Public Member Functions | |
__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 () | |
Public Attributes | |
const | DEFAULT_TAG_LENGTH = 16 |
Interface for encryption/decryption primitives.
Definition at line 13 of file CryptoInterface.php.
fpoirotte\Cryptal\Implementers\CryptoInterface::__construct | ( | CipherEnum | $cipher, |
ModeEnum | $mode, | ||
PaddingInterface | $padding, | ||
$key, | |||
$tagLength = self::DEFAULT_TAG_LENGTH |
|||
) |
Construct a new encryption/decryption context.
CipherEnum | $cipher | Cipher algorithm to use. |
ModeEnum | $mode | Cryptography mode to apply to the cipher. |
PaddingInterface | $padding | Padding scheme to use. |
string | $key | Secret key used for encryption/decryption. |
int | $tagLength | Length (in bytes) of the authentication tags to generate. |
Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20.
fpoirotte\Cryptal\Implementers\CryptoInterface::decrypt | ( | $iv, | |
$data, | |||
$tag = null , |
|||
$aad = '' |
|||
) |
Decrypt some data.
string | $iv | Initialization Vector for the operation. |
string | $data | Data to decrypt. |
string | $tag | Authentication tag. |
string | $aad | Additional authenticated data. |
string | Plaintext (decrypted data). |
MODE_ECB
). Still, this parameter is mandatory and an empty string may be passed for those modes.MODE_GCM
& MODE_EAX
are known to support AEAD. Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh.
fpoirotte\Cryptal\Implementers\CryptoInterface::encrypt | ( | $iv, | |
$data, | |||
& | $tag = null , |
||
$aad = '' |
|||
) |
Encrypt some data.
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. |
string | Ciphertext (encrypted data). |
MODE_ECB
). Still, this parameter is mandatory and an empty string may be passed for those modes.MODE_GCM
& MODE_EAX
are known to support AEAD. Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh.
Referenced by fpoirotte\Cryptal\Modes\GCM\__construct().
fpoirotte\Cryptal\Implementers\CryptoInterface::getBlockSize | ( | ) |
Get the block size, in bytes.
int | Required size for each block. Might be zero in case the given cipher/mode combination does not use blocks. |
Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20.
Referenced by fpoirotte\Cryptal\Modes\CBC\__construct(), fpoirotte\Cryptal\Modes\OFB\__construct(), fpoirotte\Cryptal\Modes\CFB\__construct(), fpoirotte\Cryptal\Modes\CTR\__construct(), fpoirotte\Cryptal\Modes\CCM\__construct(), fpoirotte\Cryptal\Modes\GCM\__construct(), and fpoirotte\Cryptal\Modes\OCB\__construct().
fpoirotte\Cryptal\Implementers\CryptoInterface::getCipher | ( | ) |
Get the cipher used by this particular instance.
CipherEnum | Cipher in use by this instance. |
Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20.
Referenced by fpoirotte\Cryptal\Modes\EAX\__construct().
fpoirotte\Cryptal\Implementers\CryptoInterface::getIVSize | ( | ) |
Get the size of the Initialization Vector, in bytes.
int | Required size for the Initialization Vector. Might be zero in case the given cipher/mode combination does not require an initialization vector. |
Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh.
fpoirotte\Cryptal\Implementers\CryptoInterface::getKey | ( | ) |
Get the key used by this particular instance.
string | Key in use by this instance. |
Implemented in fpoirotte\Cryptal\DefaultAlgorithms\Camellia, and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20.
Referenced by fpoirotte\Cryptal\Modes\EAX\__construct().