ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
phpseclib\Crypt\AES Class Reference
+ Inheritance diagram for phpseclib\Crypt\AES:
+ Collaboration diagram for phpseclib\Crypt\AES:

Public Member Functions

 setBlockLength ($length)
 Dummy function. More...
 
 setKeyLength ($length)
 Sets the key length. More...
 
 setKey ($key)
 Sets the key. More...
 
- Public Member Functions inherited from phpseclib\Crypt\Rijndael
 setKeyLength ($length)
 Sets the key length. More...
 
 setBlockLength ($length)
 Sets the block length. More...
 
 isValidEngine ($engine)
 Test for engine validity. More...
 
 _encryptBlock ($in)
 Encrypts a block. More...
 
 _decryptBlock ($in)
 Decrypts a block. More...
 
 _setupKey ()
 Setup the key (expansion) More...
 
 _subWord ($word)
 Performs S-Box substitutions. More...
 
_getTables ()
 Provides the mixColumns and sboxes tables. More...
 
_getInvTables ()
 Provides the inverse mixColumns and inverse sboxes tables. More...
 
 _setupInlineCrypt ()
 Setup the performance-optimized function for de/encrypt() More...
 
- Public Member Functions inherited from phpseclib\Crypt\Base
 __construct ($mode=self::MODE_CBC)
 Default Constructor. More...
 
 setIV ($iv)
 Sets the initialization vector. More...
 
 setKeyLength ($length)
 Sets the key length. More...
 
 getKeyLength ()
 Returns the current key length in bits. More...
 
 getBlockLength ()
 Returns the current block length in bits. More...
 
 setKey ($key)
 Sets the key. More...
 
 setPassword ($password, $method='pbkdf2')
 Sets the password. More...
 
 encrypt ($plaintext)
 Encrypts a message. More...
 
 decrypt ($ciphertext)
 Decrypts a message. More...
 
 _openssl_ctr_process ($plaintext, &$encryptIV, &$buffer)
 OpenSSL CTR Processor. More...
 
 _openssl_ofb_process ($plaintext, &$encryptIV, &$buffer)
 OpenSSL OFB Processor. More...
 
 _openssl_translate_mode ()
 phpseclib <-> OpenSSL Mode Mapper More...
 
 enablePadding ()
 Pad "packets". More...
 
 disablePadding ()
 Do not pad packets. More...
 
 enableContinuousBuffer ()
 Treat consecutive "packets" as if they are a continuous buffer. More...
 
 disableContinuousBuffer ()
 Treat consecutive packets as if they are a discontinuous buffer. More...
 
 isValidEngine ($engine)
 Test for engine validity. More...
 
 setPreferredEngine ($engine)
 Sets the preferred crypt engine. More...
 
 getEngine ()
 Returns the engine currently being utilized. More...
 
 _setEngine ()
 Sets the engine as appropriate. More...
 
 _encryptBlock ($in)
 Encrypts a block. More...
 
 _decryptBlock ($in)
 Decrypts a block. More...
 
 _setupKey ()
 Setup the key (expansion) More...
 
 _setup ()
 Setup the self::ENGINE_INTERNAL $engine. More...
 
 _setupMcrypt ()
 Setup the self::ENGINE_MCRYPT $engine. More...
 
 _pad ($text)
 Pads a string. More...
 
 _unpad ($text)
 Unpads a string. More...
 
 _clearBuffers ()
 Clears internal buffers. More...
 
 _string_shift (&$string, $index=1)
 String Shift. More...
 
 _string_pop (&$string, $index=1)
 String Pop. More...
 
 _increment_str (&$var)
 Increment the current string. More...
 
 _setupInlineCrypt ()
 Setup the performance-optimized function for de/encrypt() More...
 
 _createInlineCryptFunction ($cipher_code)
 Creates the performance-optimized function for en/decrypt() More...
 
_getLambdaFunctions ()
 Holds the lambda_functions table (classwide) More...
 
 _hashInlineCryptFunction ($bytes)
 Generates a digest from $bytes. More...
 

Additional Inherited Members

- Data Fields inherited from phpseclib\Crypt\Rijndael
 $cipher_name_mcrypt = 'rijndael-128'
 
 $password_default_salt = 'phpseclib'
 
 $w
 
 $dw
 
 $Nb = 4
 
 $key_length = 16
 
 $Nk = 4
 
 $Nr
 
 $c
 
 $kl
 
- Data Fields inherited from phpseclib\Crypt\Base
const MODE_CTR = -1
 #+ @access public More...
 
const MODE_ECB = 1
 Encrypt / decrypt using the Electronic Code Book mode. More...
 
const MODE_CBC = 2
 Encrypt / decrypt using the Code Book Chaining mode. More...
 
const MODE_CFB = 3
 Encrypt / decrypt using the Cipher Feedback mode. More...
 
const MODE_OFB = 4
 Encrypt / decrypt using the Output Feedback mode. More...
 
const MODE_STREAM = 5
 Encrypt / decrypt using streaming mode. More...
 
const ENGINE_INTERNAL = 1
 #+ @access private More...
 
const ENGINE_MCRYPT = 2
 Base value for the mcrypt implementation $engine switch. More...
 
const ENGINE_OPENSSL = 3
 Base value for the mcrypt implementation $engine switch. More...
 
 $mode
 
 $block_size = 16
 
 $key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"
 
 $iv
 
 $encryptIV
 
 $decryptIV
 
 $continuousBuffer = false
 
 $enbuffer
 
 $debuffer
 
 $enmcrypt
 
 $demcrypt
 
 $enchanged = true
 
 $dechanged = true
 
 $ecb
 
 $cfb_init_len = 600
 
 $changed = true
 
 $padding = true
 
 $paddable = false
 
 $engine
 
 $preferredEngine
 
 $cipher_name_mcrypt
 
 $cipher_name_openssl
 
 $cipher_name_openssl_ecb
 
 $password_default_salt = 'phpseclib/salt'
 
 $inline_crypt
 
 $use_inline_crypt
 
 $openssl_emulate_ctr = false
 
 $openssl_options
 
 $explicit_key_length = false
 
 $skip_key_adjustment = false
 
- Static Public Attributes inherited from phpseclib\Crypt\Base
static $WHIRLPOOL_AVAILABLE
 

Detailed Description

Definition at line 61 of file AES.php.

Member Function Documentation

◆ setBlockLength()

phpseclib\Crypt\AES::setBlockLength (   $length)

Dummy function.

Since \phpseclib\Crypt\AES extends \phpseclib\Crypt\Rijndael, this function is, technically, available, but it doesn't do anything.

See also
\phpseclib\Crypt\Rijndael::setBlockLength() @access User interface
Parameters
int$length

Reimplemented from phpseclib\Crypt\Rijndael.

Definition at line 72 of file AES.php.

73 {
74 return;
75 }

◆ setKey()

phpseclib\Crypt\AES::setKey (   $key)

Sets the key.

Rijndael supports five different key lengths, AES only supports three.

See also
\phpseclib\Crypt\Rijndael:setKey()
setKeyLength() @access User interface
Parameters
string$key

Reimplemented from phpseclib\Crypt\Base.

Definition at line 109 of file AES.php.

110 {
111 parent::setKey($key);
112
113 if (!$this->explicit_key_length) {
114 $length = strlen($key);
115 switch (true) {
116 case $length <= 16:
117 $this->key_length = 16;
118 break;
119 case $length <= 24:
120 $this->key_length = 24;
121 break;
122 default:
123 $this->key_length = 32;
124 }
125 $this->_setEngine();
126 }
127 }
_setEngine()
Sets the engine as appropriate.
Definition: Base.php:1649

References phpseclib\Crypt\Base\$key, and phpseclib\Crypt\Base\_setEngine().

+ Here is the call graph for this function:

◆ setKeyLength()

phpseclib\Crypt\AES::setKeyLength (   $length)

Sets the key length.

Valid key lengths are 128, 192, and 256. If the length is less than 128, it will be rounded up to

  1. If the length is greater than 128 and invalid, it will be rounded down to the closest valid amount.
See also
\phpseclib\Crypt\Rijndael:setKeyLength() @access User interface
Parameters
int$length

Reimplemented from phpseclib\Crypt\Rijndael.

Definition at line 87 of file AES.php.

88 {
89 switch ($length) {
90 case 160:
91 $length = 192;
92 break;
93 case 224:
94 $length = 256;
95 }
96 parent::setKeyLength($length);
97 }

The documentation for this class was generated from the following file: