Lines Matching refs:key

56      * @see \phpseclib3\Crypt\Common\SymmetricKey::key
60 protected $key;
65 * @see \phpseclib3\Crypt\Common\SymmetricKey::key
98 * The key length in bits.
102 * {@internal Changing this value after setting the key has no effect.}
111 * The key length in bits.
131 * Twice the same 256-value sequence to save a modulus in key expansion.
204 * Inverse key expansion randomization table.
289 * Sets the key length.
291 * Valid key lengths are 8 to 1024.
292 * Calling this function after setting the key has no effect until the next
296 * @throws \LengthException if the key length isn't supported
309 * Returns the current key length
319 * Sets the key.
322 * strlen($key) <= 128), however, we only use the first 128 bytes if $key
323 * has more then 128 bytes in it, and set $key to a single null byte if
327 * @param string $key
328 * @param int|boolean $t1 optional Effective key length in bits.
329 * @throws \LengthException if the key length isn't supported
331 public function setKey($key, $t1 = false)
333 $this->orig_key = $key;
344 if (strlen($key) < 1 || strlen($key) > 128) {
345 throw new \LengthException('Key of size ' . strlen($key) . ' not supported by this algorithm. Only keys of sizes between 8 and 1024 bits, inclusive, are supported');
348 $t = strlen($key);
350 // The mcrypt RC2 implementation only supports effective key length
351 // of 1024 bits. It is however possible to handle effective key
352 // lengths in range 1..1024 by expanding the key and applying
357 $l = array_values(unpack('C*', $key));
361 // Expand key.
372 // Prepare the key for mcrypt.
376 $this->key = pack(...$l);
377 $this->key_length = strlen($this->key);
394 $temp = $this->key;
395 $this->key = $this->orig_key;
397 $this->key = $temp;
416 $temp = $this->key;
417 $this->key = $this->orig_key;
419 $this->key = $temp;
515 * Creates the key schedule
521 if (!isset($this->key)) {
527 $l = unpack('Ca/Cb/v*', $this->key);