public function encrypt($string, $encryption_key = null) { $string = (string) $string; $encryption_key = $encryption_key === null ? $this->key : (string) $encryption_key; $old_key_size = GibberishAES::size(); GibberishAES::size(256); $result = GibberishAES::enc($string, $encryption_key); GibberishAES::size($old_key_size); return $result; }
public function testEncryptionWith256BitKeySize() { GibberishAES::size(256); foreach ($this->examples as $example) { $encrypted = GibberishAES::enc($example, $this->passPhrase); $this->assertEquals($example, GibberishAES::dec($encrypted, $this->passPhrase)); } GibberishAES::size("256"); foreach ($this->examples as $example) { $encrypted = GibberishAES::enc($example, $this->passPhrase); $this->assertEquals($example, GibberishAES::dec($encrypted, $this->passPhrase)); } }
public function index() { $pass = $this->pass; $secret_string = $this->secret_string; $old_key_size = GibberishAES::size(); GibberishAES::size(256); $encrypted_secret_string_256 = GibberishAES::enc($secret_string, $pass); $decrypted_secret_string_256 = GibberishAES::dec($encrypted_secret_string_256, $pass); GibberishAES::size(192); $encrypted_secret_string_192 = GibberishAES::enc($secret_string, $pass); $decrypted_secret_string_192 = GibberishAES::dec($encrypted_secret_string_192, $pass); GibberishAES::size(128); $encrypted_secret_string_128 = GibberishAES::enc($secret_string, $pass); $decrypted_secret_string_128 = GibberishAES::dec($encrypted_secret_string_128, $pass); GibberishAES::size($old_key_size); $this->template->set(compact('pass', 'secret_string', 'encrypted_secret_string_256', 'decrypted_secret_string_256', 'encrypted_secret_string_192', 'decrypted_secret_string_192', 'encrypted_secret_string_128', 'decrypted_secret_string_128')); $this->template->set_partial('scripts', 'gibberish_aes_scripts')->build('gibberish_aes'); }
// Prepare tree if ($idTree != $elem['id_tree']) { $arbo = $tree->getPath($elem['id_tree'], true); foreach ($arbo as $folder) { $arboHtml_tmp = htmlspecialchars(stripslashes($folder->title), ENT_QUOTES); if (empty($arboHtml)) { $arboHtml = $arboHtml_tmp; } else { $arboHtml .= ' » ' . $arboHtml_tmp; } } fputs($outstream, ' <tr class="path"><td colspan="5">' . $arboHtml . '</td></tr>'); $idTree = $elem['id_tree']; } $encPw = GibberishAES::enc($elem['pw'], $_POST['pdf_password']); fputs($outstream, ' <tr class="' . $lineType . '"> <td>' . addslashes($elem['label']) . '</td> <td align="center"><span class="span_pw" id="span_' . $elem['id'] . '"><a href="#" onclick="decryptme(' . $elem['id'] . ', \'' . $encPw . '\');return false;">Decrypt </a></span><input type="hidden" id="hide_' . $elem['id'] . '" value="' . $encPw . '" /></td> <td>' . $desc . '</td> <td align="center">' . $login . '</td> <td align="center">' . $url . '</td> </tr>'); } fclose($outstream); // send back and continue echo '[{"loop":"true", "number":"' . $_POST['number'] . '", "cpt":"' . $_POST['cpt'] . '", "file":"' . $_POST['file'] . '", "idsList":"' . $_POST['idsList'] . '" , "file_link":"' . $_POST['file_link'] . '"}]'; break; //CASE export in HTML format - Iteration loop //CASE export in HTML format - Iteration loop
function preferences_save($args) { if ($args['section'] == 'jabber') { libgpl::include_php('plugins/libgpl/gibberish/GibberishAES.php'); $enabled = get_input_value('_jappix_enabled', RCUBE_INPUT_POST); $username = trim(get_input_value('_jabber_username', RCUBE_INPUT_POST)); if (!$username && $enabled) { $this->rc->output->show_message('jappix4roundcube.usernameempty', 'error'); $args['abort'] = true; } if (preg_match('/[@\\/\\ ]/', $username)) { $this->rc->output->show_message('jappix4roundcube.usernameinvalid', 'error'); $this->rc->output->set_env('jabber_username', $this->rc->config->get('jabber_username', '')); $args['abort'] = true; } else { $args['prefs']['jabber_username'] = $username; $this->rc->output->set_env('jabber_username', $args['prefs']['jabber_username']); } $domain = trim(get_input_value('_jabber_domain', RCUBE_INPUT_POST)); if (!$this->is_valid_domain_name($domain)) { $this->rc->output->show_message('jappix4roundcube.domaininvalid', 'error'); $this->rc->output->set_env('jabber_domain', $this->rc->config->get('jabber_domain', 'jappix.com')); $args['abort'] = true; } else { $args['prefs']['jabber_domain'] = $domain; $this->rc->output->set_env('jabber_domain', $args['prefs']['jabber_domain']); } $password = trim(get_input_value('_jabber_password', RCUBE_INPUT_POST)); if (!$password && $this->rc->config->get('jappix_inherit')) { $password = $this->rc->decrypt($_SESSION['password']); } if ($password) { $key = md5($this->rc->user->data['username'] . ':' . $this->rc->decrypt($_SESSION['password'])); $enc = GibberishAES::enc($password, $key); $args['prefs']['jabber_enc'] = $enc; $this->rc->output->set_env('jabber_enc', $enc); } $args['prefs']['jappix_enabled'] = $enabled; $args['prefs']['jappix_enabled'] = $args['prefs']['jappix_enabled'] ? 1 : 0; if ($args['prefs']['jappix_enabled'] == 0) { $this->rc->session->remove('jappixminiframe'); } $args['prefs']['jappix_full'] = get_input_value('_jappix_full', RCUBE_INPUT_POST); $args['prefs']['jappix_full'] = $args['prefs']['jappix_full'] ? 1 : 0; $args['prefs']['jappix_mini'] = get_input_value('_jappix_mini', RCUBE_INPUT_POST); $args['prefs']['jappix_mini'] = $args['prefs']['jappix_mini'] ? 1 : 0; $args['prefs']['jappix_mini_autologon'] = get_input_value('_jappix_mini_autologon', RCUBE_INPUT_POST); $args['prefs']['jappix_mini_autologon'] = $args['prefs']['jappix_mini_autologon'] ? 1 : 0; $this->rc->output->set_env('jabber_mini', $args['prefs']['jappix_mini'] ? true : false); $this->rc->output->set_env('jabber_autologon', $args['prefs']['jappix_mini_autologon'] ? true : false); } return $args; }
public static function enc($data, $key) { return GibberishAES::enc($data, $key); }