ILIAS
release_5-4 Revision v5.4.26-12-gabc799a52e6
|
Public Member Functions | |
__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... | |
Data Fields | |
const | MODE_CTR = -1 |
#+ 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 |
#+ 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 | |
static | $WHIRLPOOL_AVAILABLE |
phpseclib\Crypt\Base::__construct | ( | $mode = self::MODE_CBC | ) |
Default Constructor.
Determines whether or not the mcrypt extension should be used.
$mode could be:
If not explicitly set, self::MODE_CBC will be used.
int | $mode | public |
Definition at line 474 of file Base.php.
References phpseclib\Crypt\Base\$mode, and phpseclib\Crypt\Base\_setEngine().
phpseclib\Crypt\Base::_clearBuffers | ( | ) |
Clears internal buffers.
Clearing/resetting the internal buffers is done everytime after disableContinuousBuffer() or on cipher $engine (re)init ie after setKey() or setIV()
public
Definition at line 1876 of file Base.php.
Referenced by phpseclib\Crypt\Base\_setup(), phpseclib\Crypt\Base\_setupMcrypt(), phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_createInlineCryptFunction | ( | $cipher_code | ) |
Creates the performance-optimized function for en/decrypt()
Internally for phpseclib developers:
The main reason why can speed up things [up to 50%] this way are:
The basic code architectur of the generated $inline en/decrypt() lambda function, in pseudo php, is:
+-------------------------------------------------------------------------------------------—+ | callback $inline = create_function: | | lambda_function_0001_crypt_ECB($action, $text) | | { | | INSERT PHP CODE OF: | | $cipher_code['init_crypt']; // general init code. | | // ie: $sbox'es declarations used for |
// encrypt and decrypt'ing. |
---|
switch ($action) { |
case 'encrypt': |
INSERT PHP CODE OF: |
$cipher_code['init_encrypt']; // encrypt sepcific init code. |
ie: specified $key or $box |
declarations for encrypt'ing. |
foreach ($ciphertext) { |
$in = $block_size of $ciphertext; |
INSERT PHP CODE OF: |
$cipher_code['encrypt_block']; // encrypt's (string) $in, which is always: |
// strlen($in) == $this->block_size |
// here comes the cipher algorithm in action |
// for encryption. |
// $cipher_code['encrypt_block'] has to |
// encrypt the content of the $in variable |
$plaintext .= $in; |
} |
return $plaintext; |
case 'decrypt': |
INSERT PHP CODE OF: |
$cipher_code['init_decrypt']; // decrypt sepcific init code |
ie: specified $key or $box |
declarations for decrypt'ing. |
foreach ($plaintext) { |
$in = $block_size of $plaintext; |
INSERT PHP CODE OF: |
$cipher_code['decrypt_block']; // decrypt's (string) $in, which is always |
// strlen($in) == $this->block_size |
// here comes the cipher algorithm in action |
// for decryption. |
// $cipher_code['decrypt_block'] has to |
// decrypt the content of the $in variable |
$ciphertext .= $in; |
} |
return $ciphertext; |
} |
} |
+-------------------------------------------------------------------------------------------—+
See also the *::_setupInlineCrypt()'s for productive inline $cipher_code's how they works.
Structure of: $cipher_code = array( 'init_crypt' => (string) '', // optional 'init_encrypt' => (string) '', // optional 'init_decrypt' => (string) '', // optional 'encrypt_block' => (string) '', // required 'decrypt_block' => (string) '' // required );
array | $cipher_code | private |
Definition at line 2142 of file Base.php.
References phpseclib\Crypt\Base\$block_size.
Referenced by phpseclib\Crypt\Blowfish\_setupInlineCrypt(), phpseclib\Crypt\RC2\_setupInlineCrypt(), phpseclib\Crypt\Twofish\_setupInlineCrypt(), phpseclib\Crypt\Rijndael\_setupInlineCrypt(), and phpseclib\Crypt\DES\_setupInlineCrypt().
|
abstract |
Decrypts a block.
Note: Must be extended by the child * class
private
string | $in |
Referenced by phpseclib\Crypt\Base\_setEngine(), and phpseclib\Crypt\Base\decrypt().
|
abstract |
Encrypts a block.
Note: Must be extended by the child * class
private
string | $in |
Referenced by phpseclib\Crypt\Base\_setEngine(), phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
& phpseclib\Crypt\Base::_getLambdaFunctions | ( | ) |
Holds the lambda_functions table (classwide)
Each name of the lambda function, created from _setupInlineCrypt() && _createInlineCryptFunction() is stored, classwide (!), here for reusing.
The string-based index of $function is a classwide uniqe value representing, at least, the $mode of operation (or more... depends of the optimizing level) for which $mode the lambda function was created.
private
Definition at line 2509 of file Base.php.
phpseclib\Crypt\Base::_hashInlineCryptFunction | ( | $bytes | ) |
Generates a digest from $bytes.
$bytes |
Definition at line 2523 of file Base.php.
References $i, $result, $t, and GuzzleHttp\Psr7\hash().
Referenced by phpseclib\Crypt\Blowfish\_setupInlineCrypt(), phpseclib\Crypt\RC2\_setupInlineCrypt(), phpseclib\Crypt\Twofish\_setupInlineCrypt(), phpseclib\Crypt\Rijndael\_setupInlineCrypt(), and phpseclib\Crypt\DES\_setupInlineCrypt().
phpseclib\Crypt\Base::_increment_str | ( | & | $var | ) |
Increment the current string.
string | $var | private |
Definition at line 1931 of file Base.php.
References $i.
Referenced by phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_openssl_ctr_process | ( | $plaintext, | |
& | $encryptIV, | ||
& | $buffer | ||
) |
OpenSSL CTR Processor.
PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream for CTR is the same for both encrypting and decrypting this function is re-used by both Base::encrypt() and Base::decrypt(). Also, OpenSSL doesn't implement CTR for all of it's symmetric ciphers so this function will emulate CTR with ECB when necesary.
string | $plaintext | |
string | $encryptIV | |
array | $buffer |
Definition at line 1283 of file Base.php.
References phpseclib\Crypt\Base\$block_size, phpseclib\Crypt\Base\$encryptIV, $i, phpseclib\Crypt\Base\$key, $result, $start, phpseclib\Crypt\Base\_increment_str(), phpseclib\Crypt\Base\_string_pop(), and phpseclib\Crypt\Base\_string_shift().
Referenced by phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_openssl_ofb_process | ( | $plaintext, | |
& | $encryptIV, | ||
& | $buffer | ||
) |
OpenSSL OFB Processor.
PHP's OpenSSL bindings do not operate in continuous mode so we'll wrap around it. Since the keystream for OFB is the same for both encrypting and decrypting this function is re-used by both Base::encrypt() and Base::decrypt().
string | $plaintext | |
string | $encryptIV | |
array | $buffer |
Definition at line 1377 of file Base.php.
References phpseclib\Crypt\Base\$block_size, phpseclib\Crypt\Base\$key, phpseclib\Crypt\Base\_string_pop(), and phpseclib\Crypt\Base\_string_shift().
Referenced by phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_openssl_translate_mode | ( | ) |
phpseclib <-> OpenSSL Mode Mapper
May need to be overwritten by classes extending this one in some cases
Definition at line 1423 of file Base.php.
Referenced by phpseclib\Crypt\TripleDES\isValidEngine(), phpseclib\Crypt\Rijndael\isValidEngine(), phpseclib\Crypt\RC2\isValidEngine(), phpseclib\Crypt\Blowfish\isValidEngine(), and phpseclib\Crypt\DES\isValidEngine().
phpseclib\Crypt\Base::_pad | ( | $text | ) |
Pads a string.
Pads a string using the RSA PKCS padding standards so that its length is a multiple of the blocksize. $this->block_size - (strlen($text) % $this->block_size) bytes are added, each of which is equal to chr($this->block_size - (strlen($text) % $this->block_size)
If padding is disabled and $text is not a multiple of the blocksize, the string will be padded regardless and padding will, hence forth, be enabled.
string | $text | private |
Definition at line 1822 of file Base.php.
References phpseclib\Crypt\Base\$block_size, and $text.
Referenced by phpseclib\Crypt\TripleDES\encrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_setEngine | ( | ) |
Sets the engine as appropriate.
Definition at line 1649 of file Base.php.
References phpseclib\Crypt\Base\$engine, $in, phpseclib\Crypt\Base\_decryptBlock(), phpseclib\Crypt\Base\_encryptBlock(), phpseclib\Crypt\Base\_setupKey(), and phpseclib\Crypt\Base\isValidEngine().
Referenced by phpseclib\Crypt\Base\__construct(), phpseclib\Crypt\Base\disableContinuousBuffer(), phpseclib\Crypt\Base\enableContinuousBuffer(), phpseclib\Crypt\Rijndael\setBlockLength(), phpseclib\Crypt\AES\setKey(), phpseclib\Crypt\Base\setKey(), phpseclib\Crypt\Base\setKeyLength(), and phpseclib\Crypt\Base\setPreferredEngine().
phpseclib\Crypt\Base::_setup | ( | ) |
Setup the self::ENGINE_INTERNAL $engine.
(re)init, if necessary, the internal cipher $engine and flush all $buffers Used (only) if $engine == self::ENGINE_INTERNAL
_setup() will be called each time if $changed === true typically this happens when using one or more of following public methods:
Definition at line 1743 of file Base.php.
References phpseclib\Crypt\Base\_clearBuffers(), phpseclib\Crypt\Base\_setupInlineCrypt(), and phpseclib\Crypt\Base\_setupKey().
Referenced by phpseclib\Crypt\RC4\_crypt(), phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_setupInlineCrypt | ( | ) |
Setup the performance-optimized function for de/encrypt()
Stores the created (or existing) callback function-name in $this->inline_crypt
Internally for phpseclib developers:
_setupInlineCrypt() would be called only if: - $engine == self::ENGINE_INTERNAL and - $use_inline_crypt === true - each time on _setup(), after(!) _setupKey() This ensures that _setupInlineCrypt() has always a full ready2go initializated internal cipher $engine state where, for example, the keys allready expanded, keys/block_size calculated and such. It is, each time if called, the responsibility of _setupInlineCrypt(): - to set $this->inline_crypt to a valid and fully working callback function as a (faster) replacement for encrypt() / decrypt() - NOT to create unlimited callback functions (for memory reasons!) no matter how often _setupInlineCrypt() would be called. At some point of amount they must be generic re-useable. - the code of _setupInlineCrypt() it self, and the generated callback code, must be, in following order: - 100% safe - 100% compatible to encrypt()/decrypt() - using only php5+ features/lang-constructs/php-extensions if compatibility (down to php4) or fallback is provided - readable/maintainable/understandable/commented and... not-cryptic-styled-code :-) - >= 10% faster than encrypt()/decrypt() [which is, by the way, the reason for the existence of _setupInlineCrypt() :-)] - memory-nice - short (as good as possible)
Note: - _setupInlineCrypt() is using _createInlineCryptFunction() to create the full callback function code.
Definition at line 2020 of file Base.php.
Referenced by phpseclib\Crypt\Base\_setup().
|
abstract |
Setup the key (expansion)
Only used if $engine == self::ENGINE_INTERNAL
Note: Must extend by the child * class
Referenced by phpseclib\Crypt\Base\_setEngine(), and phpseclib\Crypt\Base\_setup().
phpseclib\Crypt\Base::_setupMcrypt | ( | ) |
Setup the self::ENGINE_MCRYPT $engine.
(re)init, if necessary, the (ext)mcrypt resources and flush all $buffers Used (only) if $engine = self::ENGINE_MCRYPT
_setupMcrypt() will be called each time if $changed === true typically this happens when using one or more of following public methods:
Definition at line 1776 of file Base.php.
References phpseclib\Crypt\Base\_clearBuffers().
Referenced by phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_string_pop | ( | & | $string, |
$index = 1 |
|||
) |
String Pop.
Inspired by array_pop
string | $string | |
int | $index | private |
Definition at line 1916 of file Base.php.
References $index.
Referenced by phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\_openssl_ofb_process(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_string_shift | ( | & | $string, |
$index = 1 |
|||
) |
String Shift.
Inspired by array_shift
string | $string | |
int | $index | private |
Definition at line 1899 of file Base.php.
References $index.
Referenced by phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\_openssl_ofb_process(), phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::_unpad | ( | $text | ) |
Unpads a string.
If padding is enabled and the reported padding length is invalid the encryption key will be assumed to be wrong and false will be returned.
string | $text | private |
Definition at line 1851 of file Base.php.
References $text.
Referenced by phpseclib\Crypt\TripleDES\decrypt(), and phpseclib\Crypt\Base\decrypt().
phpseclib\Crypt\Base::decrypt | ( | $ciphertext | ) |
Decrypts a message.
If strlen($ciphertext) is not a multiple of the block size, null bytes will be added to the end of the string until it is.
string | $ciphertext |
Definition at line 990 of file Base.php.
References phpseclib\Crypt\Base\$block_size, phpseclib\Crypt\Base\$debuffer, phpseclib\Crypt\Base\$decryptIV, $i, phpseclib\Crypt\Base\$inline_crypt, phpseclib\Crypt\Base\$key, $start, phpseclib\Crypt\Base\_clearBuffers(), phpseclib\Crypt\Base\_decryptBlock(), phpseclib\Crypt\Base\_encryptBlock(), phpseclib\Crypt\Base\_increment_str(), phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\_openssl_ofb_process(), phpseclib\Crypt\Base\_setup(), phpseclib\Crypt\Base\_setupMcrypt(), phpseclib\Crypt\Base\_string_shift(), and phpseclib\Crypt\Base\_unpad().
phpseclib\Crypt\Base::disableContinuousBuffer | ( | ) |
Treat consecutive packets as if they are a discontinuous buffer.
The default behavior.
Definition at line 1528 of file Base.php.
References phpseclib\Crypt\Base\_setEngine().
phpseclib\Crypt\Base::disablePadding | ( | ) |
Do not pad packets.
phpseclib\Crypt\Base::enableContinuousBuffer | ( | ) |
Treat consecutive "packets" as if they are a continuous buffer.
Say you have a 32-byte plaintext $plaintext. Using the default behavior, the two following code snippets will yield different outputs:
echo $rijndael->encrypt(substr($plaintext, 0, 16)); echo $rijndael->encrypt(substr($plaintext, 16, 16));
echo $rijndael->encrypt($plaintext);
The solution is to enable the continuous buffer. Although this will resolve the above discrepancy, it creates another, as demonstrated with the following:
$rijndael->encrypt(substr($plaintext, 0, 16)); echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16)));
echo $rijndael->decrypt($rijndael->encrypt(substr($plaintext, 16, 16)));
With the continuous buffer disabled, these would yield the same output. With it enabled, they yield different outputs. The reason is due to the fact that the initialization vector's change after every encryption / decryption round when the continuous buffer is enabled. When it's disabled, they remain constant.
Put another way, when the continuous buffer is enabled, the state of the *() object changes after each encryption / decryption round, whereas otherwise, it'd remain constant. For this reason, it's recommended that continuous buffers not be used. They do offer better security and are, in fact, sometimes required (SSH uses them), however, they are also less intuitive and more likely to cause you problems.
Definition at line 1508 of file Base.php.
References phpseclib\Crypt\Base\_setEngine().
phpseclib\Crypt\Base::enablePadding | ( | ) |
Pad "packets".
Block ciphers working by encrypting between their specified [$this->]block_size at a time If you ever need to encrypt or decrypt something that isn't of the proper length, it becomes necessary to pad the input so that it is of the proper length.
Padding is enabled by default. Sometimes, however, it is undesirable to pad strings. Such is the case in SSH, where "packets" are padded with random bytes before being encrypted. Unpad these packets and you risk stripping away characters that shouldn't be stripped away. (SSH knows how many bytes are added because the length is transmitted separately)
phpseclib\Crypt\Base::encrypt | ( | $plaintext | ) |
Encrypts a message.
$plaintext will be padded with additional bytes such that it's length is a multiple of the block size. Other cipher implementations may or may not pad in the same manner. Other common approaches to padding and the reasons why it's necessary are discussed in the following URL:
http://www.di-mgt.com.au/cryptopad.html
An alternative to padding is to, separately, send the length of the file. This is what SSH, in fact, does. strlen($plaintext) will still need to be a multiple of the block size, however, arbitrary values can be added to make it that length.
string | $plaintext |
Definition at line 692 of file Base.php.
References phpseclib\Crypt\Base\$block_size, phpseclib\Crypt\Base\$enbuffer, phpseclib\Crypt\Base\$encryptIV, $i, phpseclib\Crypt\Base\$inline_crypt, phpseclib\Crypt\Base\$iv, phpseclib\Crypt\Base\$key, $result, $size, $start, phpseclib\Crypt\Base\_clearBuffers(), phpseclib\Crypt\Base\_encryptBlock(), phpseclib\Crypt\Base\_increment_str(), phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\_openssl_ofb_process(), phpseclib\Crypt\Base\_pad(), phpseclib\Crypt\Base\_setup(), phpseclib\Crypt\Base\_setupMcrypt(), phpseclib\Crypt\Base\_string_pop(), and phpseclib\Crypt\Base\_string_shift().
phpseclib\Crypt\Base::getBlockLength | ( | ) |
phpseclib\Crypt\Base::getEngine | ( | ) |
Returns the engine currently being utilized.
Definition at line 1638 of file Base.php.
References phpseclib\Crypt\Base\$engine.
phpseclib\Crypt\Base::getKeyLength | ( | ) |
phpseclib\Crypt\Base::isValidEngine | ( | $engine | ) |
Test for engine validity.
int | $engine | public |
Definition at line 1551 of file Base.php.
References $result.
Referenced by phpseclib\Crypt\Base\_setEngine().
phpseclib\Crypt\Base::setIV | ( | $iv | ) |
Sets the initialization vector.
(optional)
SetIV is not required when self::MODE_ECB (or ie for AES: ::MODE_ECB) is being used. If not explicitly set, it'll be assumed to be all zero's.
public
string | $iv |
Definition at line 512 of file Base.php.
References phpseclib\Crypt\Base\$iv.
Referenced by phpseclib\Crypt\Base\setPassword().
phpseclib\Crypt\Base::setKey | ( | $key | ) |
Sets the key.
The min/max length(s) of the key depends on the cipher which is used. If the key not fits the length(s) of the cipher it will paded with null bytes up to the closest valid key length. If the key is more than max length, we trim the excess bits.
If the key is not explicitly set, it'll be assumed to be all null bytes.
public
string | $key |
Definition at line 573 of file Base.php.
References phpseclib\Crypt\Base\$key, phpseclib\Crypt\Base\_setEngine(), and phpseclib\Crypt\Base\setKeyLength().
Referenced by phpseclib\Crypt\Base\setPassword().
phpseclib\Crypt\Base::setKeyLength | ( | $length | ) |
Sets the key length.
Keys with explicitly set lengths need to be treated accordingly
public
int | $length |
Definition at line 530 of file Base.php.
References phpseclib\Crypt\Base\_setEngine().
Referenced by phpseclib\Crypt\Base\setKey().
phpseclib\Crypt\Base::setPassword | ( | $password, | |
$method = 'pbkdf2' |
|||
) |
Sets the password.
Depending on what $method is set to, setPassword()'s (optional) parameters are as follows: pbkdf2 or pbkdf1: $hash, $salt, $count, $dkLen
Where $hash (default = sha1) currently supports the following hashes: see: Crypt/Hash.php
string | $password | |
string | $method |
Definition at line 601 of file Base.php.
References $f, $i, $password, phpseclib\Crypt\Base\$password_default_salt, $t, phpseclib\Crypt\Base\setIV(), and phpseclib\Crypt\Base\setKey().
phpseclib\Crypt\Base::setPreferredEngine | ( | $engine | ) |
Sets the preferred crypt engine.
Currently, $engine could be:
If the preferred crypt engine is not available the fastest available one will be used
int | $engine | public |
Definition at line 1617 of file Base.php.
References phpseclib\Crypt\Base\$engine, and phpseclib\Crypt\Base\_setEngine().
phpseclib\Crypt\Base::$block_size = 16 |
Definition at line 135 of file Base.php.
Referenced by phpseclib\Crypt\Base\_createInlineCryptFunction(), phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\_openssl_ofb_process(), phpseclib\Crypt\Base\_pad(), phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::$debuffer |
Definition at line 202 of file Base.php.
Referenced by phpseclib\Crypt\Base\decrypt().
phpseclib\Crypt\Base::$decryptIV |
Definition at line 173 of file Base.php.
Referenced by phpseclib\Crypt\Base\decrypt().
phpseclib\Crypt\Base::$enbuffer |
Definition at line 192 of file Base.php.
Referenced by phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::$encryptIV |
Definition at line 163 of file Base.php.
Referenced by phpseclib\Crypt\Base\_openssl_ctr_process(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::$engine |
Definition at line 333 of file Base.php.
Referenced by phpseclib\Crypt\Base\_setEngine(), phpseclib\Crypt\Base\getEngine(), phpseclib\Crypt\RC4\isValidEngine(), phpseclib\Crypt\TripleDES\isValidEngine(), phpseclib\Crypt\Rijndael\isValidEngine(), phpseclib\Crypt\RC2\isValidEngine(), phpseclib\Crypt\Blowfish\isValidEngine(), phpseclib\Crypt\DES\isValidEngine(), phpseclib\Crypt\TripleDES\setPreferredEngine(), and phpseclib\Crypt\Base\setPreferredEngine().
phpseclib\Crypt\Base::$inline_crypt |
Definition at line 403 of file Base.php.
Referenced by phpseclib\Crypt\Base\decrypt(), and phpseclib\Crypt\Base\encrypt().
phpseclib\Crypt\Base::$iv |
Definition at line 153 of file Base.php.
Referenced by phpseclib\Crypt\Base\encrypt(), phpseclib\Crypt\TripleDES\setIV(), and phpseclib\Crypt\Base\setIV().
phpseclib\Crypt\Base::$key = "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0" |
Definition at line 144 of file Base.php.
Referenced by phpseclib\Crypt\Base\_openssl_ctr_process(), phpseclib\Crypt\Base\_openssl_ofb_process(), phpseclib\Crypt\Blowfish\_setupKey(), phpseclib\Crypt\Twofish\_setupKey(), phpseclib\Crypt\DES\_setupKey(), phpseclib\Crypt\Base\decrypt(), phpseclib\Crypt\Base\encrypt(), phpseclib\Crypt\AES\setKey(), phpseclib\Crypt\TripleDES\setKey(), phpseclib\Crypt\Base\setKey(), and phpseclib\Crypt\DES\setKey().
phpseclib\Crypt\Base::$mode |
Definition at line 127 of file Base.php.
Referenced by phpseclib\Crypt\TripleDES\__construct(), phpseclib\Crypt\Base\__construct(), phpseclib\Crypt\RC4\_crypt(), phpseclib\Crypt\DES\_processBlock(), and phpseclib\Crypt\TripleDES\isValidEngine().
phpseclib\Crypt\Base::$password_default_salt = 'phpseclib/salt' |
Definition at line 388 of file Base.php.
Referenced by phpseclib\Crypt\Base\setPassword().
const phpseclib\Crypt\Base::ENGINE_INTERNAL = 1 |
#+ private
Definition at line 109 of file Base.php.
Referenced by phpseclib\Crypt\RC4\decrypt(), and phpseclib\Crypt\RC4\encrypt().
const phpseclib\Crypt\Base::ENGINE_MCRYPT = 2 |
const phpseclib\Crypt\Base::ENGINE_OPENSSL = 3 |
Base value for the mcrypt implementation $engine switch.
Definition at line 117 of file Base.php.
Referenced by phpseclib\Crypt\RC4\isValidEngine().
const phpseclib\Crypt\Base::MODE_CBC = 2 |
Encrypt / decrypt using the Code Book Chaining mode.
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher-block_chaining_.28CBC.29
Definition at line 74 of file Base.php.
Referenced by phpseclib\Crypt\TripleDES\__construct().
const phpseclib\Crypt\Base::MODE_CFB = 3 |
Encrypt / decrypt using the Cipher Feedback mode.
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Cipher_feedback_.28CFB.29
Definition at line 80 of file Base.php.
Referenced by phpseclib\Crypt\RSA\_parseKey().
const phpseclib\Crypt\Base::MODE_CTR = -1 |
#+ public
Set to -1 since that's what Crypt/Random.php uses to index the CTR mode.
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Counter_.28CTR.29
Definition at line 62 of file Base.php.
Referenced by phpseclib\Net\SSH2\_encryption_algorithm_to_crypt_instance(), and phpseclib\Crypt\Random\string().
const phpseclib\Crypt\Base::MODE_ECB = 1 |
Encrypt / decrypt using the Electronic Code Book mode.
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Electronic_codebook_.28ECB.29
const phpseclib\Crypt\Base::MODE_OFB = 4 |
Encrypt / decrypt using the Output Feedback mode.
http://en.wikipedia.org/wiki/Block_cipher_modes_of_operation#Output_feedback_.28OFB.29
const phpseclib\Crypt\Base::MODE_STREAM = 5 |
Encrypt / decrypt using streaming mode.
Definition at line 90 of file Base.php.
Referenced by phpseclib\Crypt\RC4\__construct().