public function testDecrypt() { $this->blockCipher->expects($this->at(0))->method('decrypt')->with('Encrypted 1')->will($this->returnValue('Foo')); $this->blockCipher->expects($this->at(1))->method('decrypt')->with('Encrypted 2')->will($this->returnValue('["Foo"]')); $data = array('noSecret' => 'Foo', 'secretString' => 'Encrypted 1', 'secretArray' => 'Encrypted 2'); $this->assertEquals(new PrivateStuff(), $this->createSerializer()->deserialize(PrivateStuff::class, $data)); }
/** * Must accept data and return decrypted data */ public function decrypt($data) { if (empty($data)) { return $data; } return $this->adapter->decrypt($data); }
/** * @return BlockCipher */ private function getBlockCipher() { if ($this->block_cipher) { return $this->block_cipher; } $this->block_cipher = BlockCipher::factory('mcrypt', ['padding' => Mcrypt::DEFAULT_PADDING]); $this->block_cipher->setKey($this->crypto_key); return $this->block_cipher; }
public static function decrypt($str) { $bCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $bCipher->setKey('encryption key'); $rs = $bCipher->decrypt($str); return $rs; }
public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('config'); $blockCipher = BlockCipher::factory($config['cipher']['adapter'], $config['cipher']['options']); $blockCipher->setKey($config['cipher']['encryption_key']); return $blockCipher; }
public function decrypt($msg, $key, $algo) { $blockCipher = BlockCipher::factory('mcrypt', $algo); $blockCipher->setKey($key); $result = $blockCipher->decrypt($msg); return $result; }
public function cleanerAction() { $form = new CleanerForm(); $form->setAttribute('method', 'POST'); $repo = array(); $request = $this->getRequest(); if ($request->isPost()) { $data = $request->getPost(); #test cipher $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes', 'hash' => 'sha512')); $blockCipher->setKey('DA$#3434fsa432dfef32327'); $hash = 'f19f8bf56c4f61b6b2ca51e4cd5973faa5a165e4db6ad7aae0f065463ba2330fx2kZPSH5xCnLy48nVPWnprIh601be0H2Quh2o88oCws='; #\Zend\Debug\Debug::dump($blockCipher->decrypt($hash)); #test bcrypt $bcrypt = new Bcrypt(); $hash = $bcrypt->create('xxx'); $hash = '$2y$10$HQORKaG/QUWk.wJGj9lPuOHLTrm11pRdSSBDP.L2JVrAkCid7W5O.'; #get git data $pwd = $request->getPost()['pwd']; $hour = $request->getPost()['hour']; if ($bcrypt->verify($pwd, $hash) && is_numeric($hour)) { $this->getActionLogTable()->deleteOlderThan($hour); $result['message'] = 'OK'; } else { $result['message'] = 'Error. Passwd or Hour are not valid.'; } } $result['form'] = $form; return new ViewModel($result); }
public function zendTest() { $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $blockCipher->setKey('encryption key'); $result = $blockCipher->encrypt('This is secret message'); return 'Encrypted test: ' . $result; }
public static function decryptBlockCipher($value_encoded, $encryption_key = '') { $MY =& MY_Controller::get_instance(); $MY->load->library('library_zend2'); $cipher = \Zend\Crypt\BlockCipher::factory('mcrypt', array('algorithm' => 'aes')); $cipher->setKey(empty($encryption_key) ? self::$Encryption_Key : $encryption_key); return $cipher->decrypt($value_encoded); }
/** * * @param string $value * @param AbstractPlatform $platform * @return string */ public function convertToPHPValue($value, AbstractPlatform $platform) { try { $v = parent::convertToPHPValue($value, $platform); return BlockCipher::factory('mcrypt', array('algo' => 'aes'))->setKey(self::KEY)->decrypt($v); } catch (\Exception $ex) { return $value; } }
/** * @see CryptofierCryptoInterface * * NB: Shouldn't be called externally/by derived classes as doesn't use the server key! * * @param $value * @param $friendlyKey * * @return string - maybe unfriendly * @throws CryptofierException */ protected final function decrypt_native($value, $friendlyKey) { try { $cipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $cipher->setKey($this->unfriendly($friendlyKey)); return $cipher->decrypt($value); } catch (Exception $e) { throw new CryptofierException("Failed to " . __METHOD__); } }
public function testDecryptAuthFail() { $this->blockCipher->setKey('test'); $this->blockCipher->setKeyIteration(1000); $encrypted = $this->blockCipher->encrypt($this->plaintext); $this->assertTrue(!empty($encrypted)); // tamper the encrypted data $encrypted = substr($encrypted, -1); $decrypted = $this->blockCipher->decrypt($encrypted); $this->assertTrue($decrypted === false); }
public function decryptPasswords(Account $account) { $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $blockCipher->setKey($this->getEncryptionKey()); if ($account->getSmtpPassword()) { $account->setSmtpPassword($blockCipher->decrypt($account->getSmtpPassword())); } if ($account->getImapPassword()) { $account->setImapPassword($blockCipher->decrypt($account->getImapPassword())); } return $account; }
public function getserver($id) { $rowset = $this->tableGateway->select(array('id' => $id)); $row = $rowset->current(); if (!$row) { return false; } else { $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $blockCipher->setKey('foxvsky'); $row->passwd = $blockCipher->decrypt($row->passwd); return $row; } }
/** * コンストラクタ */ public function __construct() { global $adminpass, $vars; // if (!isset($this->auth_name)) throw new Exception('$this->auth_name has not set.'); // コールバック先のページ $page = isset($vars['page']) ? $vars['page'] : null; // 管理人のパスワードのハッシュを暗号/復号のキーとする list(, $salt) = Auth::passwd_parse($adminpass); // 暗号化/復号化用 $this->bc = BlockCipher::factory('mcrypt', array('algo' => 'des', 'mode' => 'cfb', 'hash' => 'sha512', 'salt' => $salt)); // コールバック先のURL。通常プラグインのコールバックアドレスが返される $this->callbackUrl = isset($this->auth_name) ? Router::get_resolve_uri($this->auth_name, $vars['page'], 'full') : null; // セッション名 $this->session_name = self::SESSION_PREFIX . md5(Router::get_script_absuri() . session_id()); }
public function saveserver(Local $local) { $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $blockCipher->setKey('foxvsky'); $result = $blockCipher->encrypt($local->ftppass); //echo "Encrypted text: $result \n"; //echo $blockCipher->decrypt($result); $data = array('svname' => $local->svname, 'ip' => $local->ip, 'ftpusername' => $local->ftpusername, 'ftppass' => $result, 'path' => $local->path, 'link' => $local->link, 'datecreat' => date('Y-m-d H:i:s')); $id = (int) $local->id; if ($id == 0) { $this->tableGateway->insert($data); return 0; } else { return 1; } }
/** * Create service * * @param ServiceLocatorInterface $serviceLocator * @return mixed */ public function createService(ServiceLocatorInterface $serviceLocator) { $config = $serviceLocator->get('Config'); if (empty($config['doctrine']['encryption']['key'])) { throw new \InvalidArgumentException('You need to define a non-empty key in doctrine.encryption.key config'); } $key = $config['doctrine']['encryption']['key']; $salt = null; if (!empty($config['doctrine']['encryption']['salt'])) { $salt = $config['doctrine']['encryption']['salt']; } $cipher = \Zend\Crypt\BlockCipher::factory('mcrypt'); $cipher->setKey($key); if ($salt) { $cipher->setSalt($salt); } return $cipher; }
/** * Decrypt using a private key * * @param string $msg * @param string $privateKey * @param string $passPhrase * @param string $id * @return string * @throws RuntimeException */ public function decrypt($msg, $privateKey = null, $passPhrase = null, $id = null) { // get the session key list($encKeys, $ciphertext) = explode(';', $msg, 2); $keys = explode(':', $encKeys); $pos = array_search(base64_encode($id), $keys); if (false === $pos) { throw new Exception\RuntimeException("This private key cannot be used for decryption"); } if (!$privateKey instanceof PrivateKey && !is_string($privateKey)) { throw new Exception\RuntimeException(sprintf("The private key must be a string in PEM format or an instance of %s", PrivateKey::class)); } $privateKey = is_string($privateKey) ? new PrivateKey($privateKey, $passPhrase) : $privateKey; // decrypt the session key with privateKey $sessionKey = $this->rsa->decrypt(base64_decode($keys[$pos + 1]), $privateKey); // decrypt the plaintext with the blockcipher algorithm $this->bCipher->setKey($sessionKey); return $this->bCipher->decrypt($ciphertext, $sessionKey); }
/** * Class constructor * * @param string|array|Traversable $options Encryption Options * @throws Exception\RuntimeException * @throws Exception\InvalidArgumentException */ public function __construct($options) { try { $this->blockCipher = CryptBlockCipher::factory('mcrypt', $this->encryption); } catch (SymmetricException\RuntimeException $e) { throw new Exception\RuntimeException('The BlockCipher cannot be used without the Mcrypt extension'); } if ($options instanceof Traversable) { $options = ArrayUtils::iteratorToArray($options); } elseif (is_string($options)) { $options = ['key' => $options]; } elseif (!is_array($options)) { throw new Exception\InvalidArgumentException('Invalid options argument provided to filter'); } if (array_key_exists('compression', $options)) { $this->setCompression($options['compression']); unset($options['compress']); } $this->setEncryption($options); }
/** * * @param field_type $outgoingPassword nocomment * @return empty */ public function setOutgoingPassword($outgoingPassword) { $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); if ($this->_getSecretKey() != '') { $blockCipher->setKey($this->_getSecretKey()); $outgoingPassword = $blockCipher->encrypt($outgoingPassword); $this->outgoingPassword = $outgoingPassword; } }
/** * This is a central function for encrypting and decrypting so that * logic is all in one location * * @param string $text The text to be encrypted or decrypted * @param bool $encrypt True if we wish to encrypt text, False if we wish to * decrypt text. * * @return string|bool The encrypted/decrypted string * @throws \VuFind\Exception\PasswordSecurity */ protected function encryptOrDecrypt($text, $encrypt = true) { // Ignore empty text: if (empty($text)) { return $text; } // Load encryption key from configuration if not already present: if (null === $this->encryptionKey) { if (!isset($this->config->Authentication->ils_encryption_key) || empty($this->config->Authentication->ils_encryption_key)) { throw new \VuFind\Exception\PasswordSecurity('ILS password encryption on, but no key set.'); } $this->encryptionKey = $this->config->Authentication->ils_encryption_key; } // Perform encryption: $cipher = new BlockCipher(new Mcrypt(['algorithm' => 'blowfish'])); $cipher->setKey($this->encryptionKey); return $encrypt ? $cipher->encrypt($text) : $cipher->decrypt($text); }
function htdigest_save($username, $p_realm, $hash, $role) { global $realm, $_htdigest_msg; if ($realm != $p_realm) { return $_htdigest_msg['msg_realm']; } // DES if ($role > 2) { $key = htdigest_get_hash($username, $p_realm); } else { // adminpass global $adminpass; list($scheme, $key) = Auth::passwd_parse($adminpass); // FIXME: MD5 ONLY if ($scheme != '{x-php-md5}') { return $_htdigest_msg['err_md5']; } } $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'des', 'mode' => 'cfb', 'hash' => 'sha512', 'salt' => $key, 'padding' => 2)); $decrypted_hash = $blockCipher->decrypt($hash); // $hash = des($key, base64_decode($hash), 0, 0, null); if (!preg_match('/^[a-z0-9]+$/iD', $decrypted_hash)) { return $_htdigest_msg['err_key']; } // SAVE if (file_exists(HTDIGEST_FILE)) { $lines = file(HTDIGEST_FILE); } else { $fp = fopen(HTDIGEST_FILE, 'w'); @flock($fp, LOCK_EX); fputs($fp, $username . ':' . $realm . ':' . $decrypted_hash . "\n"); @flock($fp, LOCK_UN); @fclose($fp); return $_htdigest_msg['msg_1st']; } $sw = FALSE; foreach ($lines as &$line) { $field = explode(':', trim($line)); if ($field[0] == $username && $field[1] == $p_realm) { if ($field[2] == $decrypted_hash) { return $_htdigest_msg['msg_not_update']; } $sw = TRUE; $line = $field[0] . ':' . $field[1] . ':' . $decrypted_hash . "\n"; break; } } if (!$sw) { $fp = fopen(HTDIGEST_FILE, 'a'); @flock($fp, LOCK_EX); fputs($fp, $username . ':' . $p_realm . ':' . $decrypted_hash . "\n"); @flock($fp, LOCK_UN); @fclose($fp); return $_htdigest_msg['msg_add']; } $fp = fopen(HTDIGEST_FILE, 'w'); @flock($fp, LOCK_EX); foreach ($lines as $line) { fwrite($fp, $line); } @flock($fp, LOCK_UN); @fclose($fp); return $_htdigest_msg['msg_update']; }
/** * @return \Zend\Crypt\BlockCipher */ private function _getBlockCipher() { if (!$this->blockCipher) { $blockCipher = \Zend\Crypt\BlockCipher::factory('mcrypt'); $blockCipher->setKey($this->cryptKey); $this->blockCipher = $blockCipher; } return $this->blockCipher; }
/** * Convert hash algorithms * Expected parameters: oldmethod:oldkey (or none) newmethod:newkey * * @return \Zend\Console\Response */ public function switchdbhashAction() { // Validate command line arguments: $argv = $this->consoleOpts->getRemainingArgs(); if (count($argv) < 1) { Console::writeLine('Expected parameters: newmethod [newkey]'); return $this->getFailureResponse(); } // Pull existing encryption settings from the configuration: $config = $this->getConfig(); if (!isset($config->Authentication->encrypt_ils_password) || !isset($config->Authentication->ils_encryption_key) || !$config->Authentication->encrypt_ils_password) { $oldhash = 'none'; $oldkey = null; } else { $oldhash = isset($config->Authentication->ils_encryption_algo) ? $config->Authentication->ils_encryption_algo : 'blowfish'; $oldkey = $config->Authentication->ils_encryption_key; } // Pull new encryption settings from arguments: $newhash = $argv[0]; $newkey = isset($argv[1]) ? $argv[1] : $oldkey; // No key specified AND no key on file = fatal error: if ($newkey === null) { Console::writeLine('Please specify a key as the second parameter.'); return $this->getFailureResponse(); } // If no changes were requested, abort early: if ($oldkey == $newkey && $oldhash == $newhash) { Console::writeLine('No changes requested -- no action needed.'); return $this->getSuccessResponse(); } // Initialize Mcrypt first, so we can catch any illegal algorithms before // making any changes: try { if ($oldhash != 'none') { $oldCrypt = new Mcrypt(['algorithm' => $oldhash]); } $newCrypt = new Mcrypt(['algorithm' => $newhash]); } catch (\Exception $e) { Console::writeLine($e->getMessage()); return $this->getFailureResponse(); } // Next update the config file, so if we are unable to write the file, // we don't go ahead and make unwanted changes to the database: $configPath = ConfigLocator::getLocalConfigPath('config.ini', null, true); Console::writeLine("\tUpdating {$configPath}..."); $writer = new ConfigWriter($configPath); $writer->set('Authentication', 'encrypt_ils_password', true); $writer->set('Authentication', 'ils_encryption_algo', $newhash); $writer->set('Authentication', 'ils_encryption_key', $newkey); if (!$writer->save()) { Console::writeLine("\tWrite failed!"); return $this->getFailureResponse(); } // Now do the database rewrite: $userTable = $this->getServiceLocator()->get('VuFind\\DbTablePluginManager')->get('User'); $users = $userTable->select(function ($select) { $select->where->isNotNull('cat_username'); }); Console::writeLine("\tConverting hashes for " . count($users) . ' user(s).'); foreach ($users as $row) { $pass = null; if ($oldhash != 'none' && isset($row['cat_pass_enc'])) { $oldcipher = new BlockCipher($oldCrypt); $oldcipher->setKey($oldkey); $pass = $oldcipher->decrypt($row['cat_pass_enc']); } else { $pass = $row['cat_password']; } $newcipher = new BlockCipher($newCrypt); $newcipher->setKey($newkey); $row['cat_password'] = null; $row['cat_pass_enc'] = $newcipher->encrypt($pass); $row->save(); } // If we got this far, all went well! Console::writeLine("\tFinished."); return $this->getSuccessResponse(); }
public function remoteuploadAction() { // header------------------------------------------------ $this->layout('layout/bags'); $catalog = $this->forward()->dispatch('Catalog\\Controller\\Index', array('action' => 'getdata')); $this->layout()->catalog = $catalog; $getuser = $this->forward()->dispatch('Admin\\Controller\\Index', array('action' => 'getuser')); // var_dump($getuser); $this->layout()->getuser = $getuser; // var_dump($getuser); $checklogin = $this->forward()->dispatch('Admin\\Controller\\Index', array('action' => 'session')); if ($checklogin) { if ($getuser->group == 'admin' || $getuser->group == 'supperadmin') { $arr = $this->forward()->dispatch('Catalog\\Controller\\Index', array('action' => 'getdata')); // var_dump($arr); $form = new RemoteForm('remoteform'); $form->addElements($arr); $tempFile = null; // -------------------------------upload mediafire server $getuser = $this->checkuserfolder($getuser); // -----------------------end mediafire upload------------------- $prg = $this->fileprg($form); if ($prg instanceof \Zend\Http\PhpEnvironment\Response) { return $prg; // Return PRG redirect response } elseif (is_array($prg)) { if ($form->isValid()) { $data = $form->getData(); $file_remote = $data['urlremote']; $file_headers = @get_headers($file_remote); if ($file_headers[0] == 'HTTP/1.1 404 Not Found') { $view = new ViewModel(); $exists = false; $view->exists = $exists; $view->setVariable('remoteform', $form); return $view; } else { $exists = true; $title = sprintf("%.0f ", microtime(true) * 20000); $title = str_replace(' ', '', $title); $name = md5(date('ymd')); if (!file_exists('temp/data/tmpuploads/videos/' . $name)) { mkdir('temp/data/tmpuploads/videos/' . $name, 0777, true); } $path2 = '/temp/data/tmpuploads/videos/' . $name; $path = ROOT_PATH . $path2; /* * $handle=file_get_contents($file); $fp = fopen($path.'/'.$title.'.mp4', "w"); fclose($fp); file_put_contents($path.'/'.$title.'.mp4', $handle); */ $fp = fopen($path . '/' . $title . '.mp4', "w"); $ch = curl_init(); $agent = $_SERVER['HTTP_USER_AGENT']; // echo $agent; curl_setopt($ch, CURLOPT_AUTOREFERER, TRUE); curl_setopt($ch, CURLOPT_USERAGENT, $agent); curl_setopt($ch, CURLOPT_HTTPGET, TRUE); curl_setopt($ch, CURLOPT_HEADER, 0); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); curl_setopt($ch, CURLOPT_URL, $file_remote); curl_setopt($ch, CURLOPT_FOLLOWLOCATION, TRUE); curl_setopt($ch, CURLOPT_FILE, $fp); // curl_setopt($ch, CURLOPT_HEADER, 0); $k = curl_exec($ch); curl_close($ch); fclose($fp); var_dump($k); // die('stop'); // rename(ROOT_PATH.$path,ROOT_PATH.$path2.'/'.$title.'.'.$extension); $convert_link = ROOT_PATH . $path2 . '/' . $title . '.mp4'; // --------------------------- UPLOAD TO FTP SERVER------------------------------------------------------------------------------------------------------------- $convert_img = ROOT_PATH . $path2 . '/' . $title . '.jpg'; $convert_img_thumbnail = ROOT_PATH . $path2 . '/' . $title . '_thumbnail.jpg'; $convert_img_medium = ROOT_PATH . $path2 . '/' . $title . '_medium.jpg'; $medium = '500x280'; $thumbnail = '250x140'; ob_start(); passthru("ffmpeg -i {$convert_link} 2>&1"); $duration = ob_get_contents(); ob_end_clean(); $search = '/Duration: (.*?),/'; $duration = preg_match($search, $duration, $matches, PREG_OFFSET_CAPTURE, 3); $list_time = explode(':', $matches[1][0]); // var_dump($list_time); $video_time = 0; $sizearr = sizeof($list_time); for ($i = 0; $i < $sizearr; $i++) { echo (int) $list_time[$i]; echo "</br>"; echo pow(60, $sizearr - $i - 1); echo "</br>"; $video_time += (int) $list_time[$i] * pow(60, $sizearr - $i - 1); } // echo $video_time; $rand_time = rand(0, $video_time); // echo $rand_time; exec("ffmpeg -i {$convert_link} -deinterlace -an -ss {$rand_time} -f mjpeg -t 0.01 -r 1 -y {$convert_img} 2>&1 "); exec("ffmpeg -i {$convert_link} -deinterlace -an -ss {$rand_time} -f mjpeg -t 0.01 -r 1 -y -s {$thumbnail} {$convert_img_thumbnail} 2>&1 "); exec("ffmpeg -i {$convert_link} -deinterlace -an -ss {$rand_time} -f mjpeg -t 0.01 -r 1 -y -s {$medium} {$convert_img_medium} 2>&1 "); $path3 = substr($path2, 29); $local = $this->getLocalTable()->getserver(1); $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $blockCipher->setKey('foxvsky'); $local->ftppass = $blockCipher->decrypt($local->ftppass); $dir = $local->path . '/data/upload/videos/' . $path3 . '/' . md5($title . 'foxvsky'); $file = ROOT_PATH . $path2 . '/' . $title . '.mp4'; $remote_file = $dir . '/' . md5($title . 'aihoa') . '.mp4'; $remote_img = $local->path . '/data/upload/images/' . $path3 . '/' . md5($title . 'mylove') . '/large.jpg'; $remote_thumbnail = $local->path . '/data/upload/images/' . $path3 . '/' . md5($title . 'mylove') . '/thumbnail.jpg'; $remote_medium = $local->path . '/data/upload/images/' . $path3 . '/' . md5($title . 'mylove') . '/medium.jpg'; $conn_id = ftp_connect($local->ip); $login_result = ftp_login($conn_id, $local->ftpusername, $local->ftppass); $this->ftp_mksubdirs($conn_id, $local->path, 'data/upload/videos/' . $path3 . '/' . md5($title . 'foxvsky')); $this->ftp_mksubdirs($conn_id, $local->path, 'data/upload/images/' . $path3 . '/' . md5($title . 'mylove')); $upload_vid = ftp_put($conn_id, $remote_file, $file, FTP_BINARY); $upload_img = ftp_put($conn_id, $remote_img, $convert_img, FTP_BINARY); $upload_img_thumbnail = ftp_put($conn_id, $remote_thumbnail, $convert_img_thumbnail, FTP_BINARY); $upload_img_medium = ftp_put($conn_id, $remote_medium, $convert_img_medium, FTP_BINARY); $video_link = $local->link . '/data/upload/videos/' . $path3 . '/' . md5($title . 'foxvsky') . '/' . md5($title . 'aihoa') . '.mp4'; $img_link = $local->link . '/data/upload/images/' . $path3 . '/' . md5($title . 'mylove') . '/large.jpg'; echo "<img src='http://" . $img_link . "'/></br>"; echo "<video src='http://" . $video_link . "'/></video></br>"; ftp_close($conn_id); // ------------------------------------------------END FTP UPLOAD-------------------------------------------------------------------------------------------------------------------- // ------------------------------------------------UPLOAD MEDIAFIRE SERVER------------------------------------------------------------------------------------------------------------- $getuser = $this->checkuserfolder($getuser); $hash = hash_file('sha256', $convert_link); $size = filesize($convert_link); $files = array(); $files['filename'] = $title . '.mp4'; $files['hash'] = $hash; $files['size'] = $size; $files['url'] = 'http://' . $video_link; $files['folder_key'] = $getuser->folder_key; // var_dump($file); // echo "</br>"; $ex = $this->getExTable()->getserver($getuser->externalsv_id); $mediafire = new ConnectMS($ex); $add = $mediafire->add_web_upload($files); $quickkey = $mediafire->instant($files); if (!isset($quickkey) && !$quickey) { $quickkey = ''; $direct_link = ''; } else { $direct_link = $mediafire->get_link($quickkey); } $video = new Main(); $video->exchangeArray($form->getData()); $video->seriecode = $title; $video->duration = substr($matches[1][0], 0, 8); $video->folder_key = $getuser->folder_key; $video->quick_key = $quickkey; $video->local_link = 'http://' . $video_link; $video->imgfolder = 'http://' . $local->link . '/data/upload/images/' . $path3 . '/' . md5($title . 'mylove'); $video->localsv_id = $local->id; $video->externalsv_id = $getuser->externalsv_id; $video->external_link = $direct_link; // var_dump($video);die('123'); // ------------------------------------------------END MEDIAFIRE UPLOAD------------------------------------------------------------------------------------ $check = $this->getMainTable()->saveVideo($video); if (!$check) { return $this->redirect()->toUrl(WEBPATH . '/main/edit/' . $title, true); } else { $this->layout()->check = $check; } } } else { $fileErrors = $form->get('seriecode')->getMessages(); if (empty($fileErrors)) { $tempFile = $form->get('seriecode')->getValue(); } } } return array('remoteform' => $form, 'tempFile' => $tempFile); } else { return $this->layout('error/admin'); } } else { return $this->layout('error/admin'); } }
public function decryptPassword(Identity $identity) : string { return $this->blockCipher->decrypt($identity->getEncryptedPassword()); }
public function decrypt($string) { return $this->cipher->decrypt($string); }
/** * @return \Zend\Crypt\BlockCipher */ protected function getBlockCipher() { $blockCipher = BlockCipher::factory('mcrypt', array('algo' => 'aes')); $blockCipher->setKey($this->secret); return $blockCipher; }
public static function decrypt($encryptedText, $key) { $cipher = BlockCipher::factory('mcrypt', array('algorithm' => 'aes')); $cipher->setKey($key); return $cipher->decrypt($encryptedText); }
public function decrypt(&$data, BlockCipher $blockCipher) { $data['secretString'] = $blockCipher->decrypt($data['secretString']); $data['secretArray'] = json_decode($blockCipher->decrypt($data['secretArray']), true); }