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= '') | |
getIVSize () | |
Public Member Functions inherited from fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20 | |
__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 () | |
Protected Attributes | |
$cipher | |
$header | |
Header encryptor. | |
$key | |
$main | |
Main encryptor. | |
Protected Attributes inherited from fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20 | |
$cipher | |
$key | |
Secret key used to encrypt/decrypt data. | |
$tagLength | |
Tag length in bytes; 16 when AEAD is enabled, 0 otherwise. | |
Additional Inherited Members | |
Public Attributes inherited from fpoirotte\Cryptal\Implementers\CryptoInterface | |
const | DEFAULT_TAG_LENGTH = 16 |
Protected Member Functions inherited from fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20 | |
basicXcrypt ($plain, $iv, $counter=0) | |
block ($iv, $counter) | |
Static Protected Member Functions inherited from fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20 | |
static | quarterRound (&$a, &$b, &$c, &$d) |
ChaCha20 block cipher with AEAD (OpenSSH variante).
Definition at line 25 of file ChaCha20Openssh.php.
fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh::__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. |
Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 36 of file ChaCha20Openssh.php.
References fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20\$tagLength.
fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh::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. Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 92 of file ChaCha20Openssh.php.
References fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh\getIVSize(), and fpoirotte\Cryptal\Implementers\AbstractMac\mac().
fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh::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. Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 69 of file ChaCha20Openssh.php.
References fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh\getIVSize(), and fpoirotte\Cryptal\Implementers\AbstractMac\mac().
fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh::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. |
Implements fpoirotte\Cryptal\Implementers\CryptoInterface.
Definition at line 118 of file ChaCha20Openssh.php.
Referenced by fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh\decrypt(), and fpoirotte\Cryptal\DefaultAlgorithms\ChaCha20Openssh\encrypt().