Generate new key.

@return void
431284
public function key() {
        $set = $this->getConsole()->setKey();
        return $set ? Colors::GREEN."Application key set successfully." : Colors::RED."Error: Key is not set.";
    }
901073
protected function createSSHKeys()
    {
        $email = $this->argument('email') ? $this->argument('email') : $this->getEmail();
        $this->info("Running ssh-keygen -t rsa -b 4096 -C '$email'");
        passthru('ssh-keygen -t rsa -b 4096 -C "' . $email . '"');
    }
532144
public function createPrivateKey()
    {
        $rsa = new RSA();
        $rsa->setPrivateKeyFormat(RSA::PRIVATE_FORMAT_PKCS1);

        return $rsa->createKey($this->getPrivateKeySize())['privatekey'];
    }
501263
function _setupKey()
    {
        if (!isset($this->key)) {
            $this->setKey('');
        }

        // Key has already been expanded in Crypt_RC2::setKey():
        // Only the first value must be altered.
        $l = unpack('Ca/Cb/v*', $this->key);
        array_unshift($l, $this->pitable[$l['a']] | ($l['b'] << 8));
        unset($l['a']);
        unset($l['b']);
        $this->keys = $l;
    }
137851
public function keys(): Set
    {
        $key = function($pair) {
            return $pair->key;
        };

        return new Set(array_map($key, $this->pairs));
    }
624362
final public function generate() {
        $options = array_merge($this->options, (array) 'generate');
        Generator::call($this->called, $this->args, $options);
    }
123835
public function addKey( $key )
	{
		if( is_array( $key ) )
			return $this->addKeys( $key );
		if( in_array( $key, $this->keys ) )
			return FALSE;
		$this->keys[] = $key;
		return TRUE;
	}
26379
protected function _addKey($key)
    {
        if ($key == '__stored_keys__') {
            return $this;
        }

        $keys = $this->get('__stored_keys__', []);
        if (!in_array($key, $keys)) {
            array_push($keys, $key);
        }
        $this->set('__stored_keys__', $keys, 24*60*60);
        return $this;
    }
778047
public function generate(): void
    {
        $this->filesystem->mkdir($this->getDirectories());

        foreach ($this->getFiles() as $filePath => $fileContent) {
            $this->filesystem->dumpFile($filePath, $fileContent);
        }

        $this->filesystem->remove($this->clean());
    }
401045
public function keys()
    {
        return $this->create(array_keys($this->toArray()))->map(
            function ($key) {
                return new String($key);
            }
        );
    }
510262
public function generate() {
        $strong = false;
        $i = 0;

        while (!$strong && $this->maxTries > $i++) {
            $data = openssl_random_pseudo_bytes(32, $strong);
        }

        if (!$strong) {
            throw new RuntimeException('Could not generate private key');
        }

        // base64_encode to get a decent ascii compatible format, and trim ending ='s.
        $key = rtrim(base64_encode($data), '=');

        // We change +/ into -_ to avoid any human confusion with paths
        return strtr($key, '+/', '-_');
    }
335523
static function createKeys()
    {
        shuffle(static::$base);
        shuffle(static::$extra_base);
        return file_put_contents(_PHP.'Config/keys/can.key', implode(static::$base)."\n".implode(static::$extra_base));
    }
592520
protected function build()
    {
        foreach ($this->keys as $tag => $code) {
            $this->tags["<{$tag}>"]    = $code;
            $this->tags["</{$tag}>"]   = $code;
            $this->tags["<\\/{$tag}>"] = $code;
        }
    }
794738
public function generate()
    {
        $key = base64_encode(openssl_random_pseudo_bytes(12).date('Y-m-d H:i:s').microtime(true));

        file_put_contents($this->setting->getConfigDirectory()."/.key", $key);

        echo "Application key => \033[0;32m$key\033[00m\n";

        exit;
    }
864018
protected function getNewKeys() {
        if (!$this->_newKeys) {
            $this->_newKeys = new NewKeyList($this->version, $this->solution['sid']);
        }

        return $this->_newKeys;
    }
121344
protected function regenerateKeyCache()
    {
        if(is_array($this->__data))
        {
            $i=0;
            $this->__keycache = array();
            $this->__keycacheindex = array();
            foreach($this->__data as $key => $value)
            {
                $this->__keycache[$key] = $i;
                $this->__keycacheindex[$i] = $key;
                $i++;
            }
        }
        else
        {
            $this->__keycache = null;
            $this->__keycacheindex = null;
        }

        $this->__keycacheinvalid = false;
    }
215971
private function seed()
    {
        foreach ($this->input as $key => $value) {
            if (!$this->call($this->before, $value, $key)) {
                return;
            }

            yield $key => $value;

            if (!$this->call($this->after, $value, $key)) {
                return;
            }
        }
    }