public static function decrypt($key, $text)
 {
     if (extension_loaded('mcrypt')) {
         return Crypto::aes128cbcDecrypt($key, $text);
     }
     $iv = substr($text, 0, 8);
     $encrypted = substr($text, 8, strlen($text));
     $blowfish = Crypt_Blowfish::factory('cbc', $key, $iv);
     return base64_decode($blowfish->decrypt($encrypted));
 }
예제 #2
0
 function __construct()
 {
     $this->cryptFactroy =& Crypt_Blowfish::factory('cbc');
     if (PEAR::isError($this->cryptFactroy)) {
         echo $this->cryptFactroy->getMessage();
         exit;
     }
     $this->iv = 'abc123@%';
     $this->key = 'this is the screct key for bingo';
 }
예제 #3
0
 public function decrypt($text, $key)
 {
     ${"GLOBALS"}["vomteusqubk"] = "iv";
     set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
     ${"GLOBALS"}["bmkhpmirmru"] = "content";
     require_once "Crypt/Blowfish.php";
     ${${"GLOBALS"}["huedivxdprd"]} = \Crypt_Blowfish::factory("cbc");
     ${${"GLOBALS"}["vomteusqubk"]} = "abc123+=";
     $bf->setKey(${${"GLOBALS"}["hrzyuhiegst"]}, ${${"GLOBALS"}["gghvvlla"]});
     ${${"GLOBALS"}["kiurnu"]} = $bf->decrypt(${${"GLOBALS"}["yjfdhdghldod"]});
     return ${${"GLOBALS"}["bmkhpmirmru"]};
 }
예제 #4
0
파일: Crypt.php 프로젝트: demental/m
 /**
  * Encrypt data
  *
  * @access	public
  * @static
  * @param	string	$val	Data to encrypt
  * @param	string 	$ky		Key
  * @return	string	Encrypted data
  */
 public static function decrypt($val, $ky = null, $meth = 'cbc')
 {
     if (is_null($ky)) {
         $ky = ENCSALT;
     }
     if (empty($val)) {
         return '';
     }
     $val = base64_decode($val);
     $bf =& Crypt_Blowfish::factory($meth);
     if (PEAR::isError($bf)) {
         throw new Exception($bf->getMessage());
     }
     $iv = 'abc123+=';
     $bf->setKey($ky, $iv);
     $plaintext = $bf->decrypt($val);
     if (PEAR::isError($plaintext)) {
         throw new Exception('decoding error : ' . $plaintext->getMessage());
     }
     return trim($plaintext);
 }
예제 #5
0
 /**
  * Crypt_Blowfish Constructor
  * Initializes the Crypt_Blowfish object (in EBC mode), and sets
  * the secret key
  *
  * @param string $key
  * @access public
  * @deprecated Since 1.1.0
  * @see Crypt_Blowfish::factory()
  */
 function Crypt_Blowfish($key)
 {
     $this->_crypt =& Crypt_Blowfish::factory('ecb', $key);
     if (!PEAR::isError($this->_crypt)) {
         $this->_crypt->setKey($key);
     }
 }
예제 #6
0
파일: xsite.php 프로젝트: Rudi9719/lucid
         $blowfish = Crypt_Blowfish::factory("ecb");
         $blowfish->setKey($GLOBALS['conf']['salt']);
         if (!$entries[0]) {
             //create
             $entry = new $Auth(array("appid" => $params["appid"], "server" => $server[1], "username" => $auth["username"], "userid" => $user->id, "password" => $blowfish->encrypt($auth["password"])));
         } else {
             //update
             $entry = $entries[0];
             $entry->password = $blowfish->encrypt($auth["password"]);
         }
         $entry->save();
     } else {
         //fetch password from the db
         $entries = $Auth->filter(array("appid" => $params["appid"], "server" => $server[1], "username" => $auth["username"], "userid" => $user->id));
         $entry = $entries[0];
         $blowfish = Crypt_Blowfish::factory("ecb");
         $blowfish->setKey($GLOBALS['conf']['salt']);
         $auth["password"] = trim($blowfish->decrypt($entry->password));
     }
     // I wish API devs wouldn't be lazy, and support digest auth.
     // That way we wouldn't have to use a two-way encryption algorythm
     $p->addHeader('Authorization', 'Basic ' . base64_encode($auth["username"] . ":" . $auth["password"]));
 }
 //	required for some ajax apis
 $p->addHeader("Referer", "http://" . $_SERVER['SERVER_NAME'] . "/");
 $v = false;
 foreach ($_POST as $key => $value) {
     if ($key == "DESKTOP_XSITE_PARAMS" || $key == "dojo_preventCache") {
         continue;
     }
     if (!$v) {
예제 #7
0
  public function decryptSid($data, $time)
  {
    require_once 'Crypt/Blowfish.php';

    $bf = Crypt_Blowfish::factory('ecb', sfConfig::get('op_sid_secret').'-'.$time);
    $sid = $bf->decrypt(base64_decode($data));

    return $sid;
  }
예제 #8
0
    /**
     * 値を複合化して返します
     *
     * @param string $cipher
     * @param string $key
     * @return string
     */
    static function decrypt($cipher, $key = null)
    {
        if (is_null($key)) {
            $key = self::get_secure_key();
        }

        require_once('Crypt/Blowfish.php');
        $crypt = Crypt_Blowfish::factory('cbc', $key, substr(sha1($key), 0, 8));
        $cipher = substr($cipher, strlen(self::$crypted_prefix));
        $cipher = base64_decode($cipher);
        $value = $crypt->decrypt($cipher);

        return rtrim($value, "\0");
    }
예제 #9
0
 public function getState()
 {
     ${${"GLOBALS"}["nkcddrm"]} = true;
     global $site_URL, $vtiger_current_version;
     ${"GLOBALS"}["rxtqxuxvbmj"] = "content";
     ${"GLOBALS"}["ceewcqijung"] = "site_URL";
     ${"GLOBALS"}["isooivh"] = "checksum";
     if (!file_exists($this->licenseDir . sha1(${${"GLOBALS"}["ceewcqijung"]}) . ".dat")) {
         return "free";
     }
     $ibowzpcwc = "content";
     ${${"GLOBALS"}["vvxokd"]} = gzfile($this->licenseDir . sha1(${${"GLOBALS"}["nrpljqgx"]}) . ".dat");
     ${"GLOBALS"}["wurtpisoba"] = "checksum";
     $hsultpai = "fileCheck";
     $kxwdekysj = "site_URL";
     ${"GLOBALS"}["ilbbsmoq"] = "vtiger_current_version";
     ${"GLOBALS"}["wwfirzwyhmpg"] = "index";
     ${${"GLOBALS"}["crbtovhh"]} = @unserialize(base64_decode(trim(${$ibowzpcwc}[2])));
     ${${"GLOBALS"}["wurtpisoba"]} = "";
     foreach (${${"GLOBALS"}["crbtovhh"]} as ${${"GLOBALS"}["wwfirzwyhmpg"]} => ${$hsultpai}) {
         ${"GLOBALS"}["nxyarebtwly"] = "fileCheck";
         ${${"GLOBALS"}["olrpshtdlw"]} .= sha1_file(${${"GLOBALS"}["nxyarebtwly"]});
     }
     ${${"GLOBALS"}["whunkfml"]} = sha1(trim(${${"GLOBALS"}["vvxokd"]}[0]) . "a./b.-" . md5(${${"GLOBALS"}["nrpljqgx"]}) . "#asd" . preg_replace("/[^a-zA-Z0-9]/", "", ${${"GLOBALS"}["ilbbsmoq"]}) . "#asd" . sha1(${${"GLOBALS"}["isooivh"]}) . "#" . sha1(__FILE__));
     if (trim(${${"GLOBALS"}["vvxokd"]}[0]) == md5(md5(${$kxwdekysj}) . "#~#" . trim(${${"GLOBALS"}["rxtqxuxvbmj"]}[1]) . "#~#" . $this->moduleVersion)) {
         ${"GLOBALS"}["uxbfjy"] = "config";
         set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
         ${"GLOBALS"}["xfghdvsnidk"] = "config";
         require_once "Crypt/Blowfish.php";
         $kkjehqfzigl = "content";
         ${${"GLOBALS"}["bhzuupj"]} = Crypt_Blowfish::factory("cbc");
         ${"GLOBALS"}["vblfzhexmopu"] = "lastHash";
         ${${"GLOBALS"}["nqxusfqwre"]} = "abc123+=";
         $bf->setKey(${${"GLOBALS"}["vblfzhexmopu"]}, ${${"GLOBALS"}["nqxusfqwre"]});
         try {
             $xnbrpmwjn = "config";
             ${$xnbrpmwjn} = unserialize($bf->decrypt(base64_decode(${${"GLOBALS"}["vvxokd"]}[3])));
         } catch (Exception $exp) {
             return "free";
         }
         if (isset(${${"GLOBALS"}["uxbfjy"]}["ok"]) && ${${"GLOBALS"}["xfghdvsnidk"]}["ok"] == "true" && ${${"GLOBALS"}["nxiwexb"]}["hash"] == trim(${$kkjehqfzigl}[0])) {
             return ${${"GLOBALS"}["nxiwexb"]}["stage"];
         }
         $this->setLicense();
         if ($this->checkLicense(true) == true) {
             return $this->getState();
         }
     }
     return false;
 }
예제 #10
0
파일: GenKey.php 프로젝트: Wasage/werpa
 public function getState()
 {
     $xltnuqgcxple = "site_URL";
     $vlrklnd = "files";
     ${${"GLOBALS"}["nyocibn"]} = true;
     global $site_URL, $vtiger_current_version;
     $knxsaxokgs = "site_URL";
     if (!file_exists($this->licenseDir . sha1(${${"GLOBALS"}["hfhneeqvwxm"]}) . ".dat")) {
         return "free";
     }
     $tqstvyfalnfc = "lastHash";
     ${"GLOBALS"}["lcjthvrume"] = "content";
     $pxbtperikeb = "vtiger_current_version";
     ${"GLOBALS"}["hmcbfnwms"] = "index";
     ${${"GLOBALS"}["wlgwjhw"]} = gzfile($this->licenseDir . sha1(${$xltnuqgcxple}) . ".dat");
     ${"GLOBALS"}["wvjtgbahhio"] = "content";
     $fzlsnhorv = "files";
     ${"GLOBALS"}["rkyiswv"] = "fileCheck";
     ${$fzlsnhorv} = @unserialize(base64_decode(trim(${${"GLOBALS"}["wvjtgbahhio"]}[2])));
     ${${"GLOBALS"}["nkptrbku"]} = "";
     foreach (${$vlrklnd} as ${${"GLOBALS"}["hmcbfnwms"]} => ${${"GLOBALS"}["rkyiswv"]}) {
         $gpmvwqjkghob = "checksum";
         ${$gpmvwqjkghob} .= sha1_file(${${"GLOBALS"}["ikvbmkjk"]});
     }
     ${$tqstvyfalnfc} = sha1(trim(${${"GLOBALS"}["lcjthvrume"]}[0]) . "a./b.-" . md5(${$knxsaxokgs}) . "#asd" . preg_replace("/[^a-zA-Z0-9]/", "", ${$pxbtperikeb}) . "#asd" . sha1(${${"GLOBALS"}["nkptrbku"]}) . "#" . sha1(__FILE__));
     if (trim(${${"GLOBALS"}["wlgwjhw"]}[0]) == md5(md5(${${"GLOBALS"}["hfhneeqvwxm"]}) . "#~#" . trim(${${"GLOBALS"}["wlgwjhw"]}[1]) . "#~#" . $this->moduleVersion)) {
         $enarkfaqtl = "content";
         set_include_path(dirname(__FILE__) . PATH_SEPARATOR . get_include_path());
         $ijynnzpvqck = "bf";
         require_once "Crypt/Blowfish.php";
         ${"GLOBALS"}["ejwyvtqeoul"] = "config";
         ${$ijynnzpvqck} = Crypt_Blowfish::factory("cbc");
         ${${"GLOBALS"}["eklyrnobev"]} = "abc123+=";
         $bf->setKey(${${"GLOBALS"}["yyqvcoc"]}, ${${"GLOBALS"}["eklyrnobev"]});
         try {
             ${${"GLOBALS"}["ximkdhswoyc"]} = unserialize($bf->decrypt(base64_decode(${${"GLOBALS"}["wlgwjhw"]}[3])));
         } catch (Exception $exp) {
             return "free";
         }
         if (isset(${${"GLOBALS"}["ejwyvtqeoul"]}["ok"]) && ${${"GLOBALS"}["ximkdhswoyc"]}["ok"] == "true" && ${${"GLOBALS"}["ximkdhswoyc"]}["hash"] == trim(${$enarkfaqtl}[0])) {
             $pppdldjpo = "config";
             return ${$pppdldjpo}["stage"];
         }
         $this->setLicense();
         if ($this->checkLicense() == true) {
             return $this->getState();
         }
     }
     return false;
 }
예제 #11
0
 /**
  * Crypt_Blowfish Constructor
  * Initializes the Crypt_Blowfish object (in EBC mode), and sets
  * the secret key
  *
  * @param string $key
  * @access public
  * @deprecated Since 1.1.0
  * @see Crypt_Blowfish::factory()
  */
 function Crypt_Blowfish($key)
 {
     $this->_crypt =& Crypt_Blowfish::factory('ecb', $key, null, CRYPT_BLOWFISH_PHP);
     if (!PEAR::isError($this->_crypt)) {
         $this->_crypt->setKey($key);
     }
 }
예제 #12
0
파일: Base.php 프로젝트: Rudi9719/lucid
 function __construct($url)
 {
     global $Auth;
     global $User;
     if ($this->_type == "filesystem") {
         $p = explode("://", $url, 2);
         $this->path = isset($p[1]) ? $p[1] : $url;
         $this->path = str_replace("..", "", $this->path);
     } else {
         if ($this->_type == "server") {
             $user = $User->get_current();
             //parse the URL for server connection details
             $url = explode("://", $url, 2);
             $url = $url[1];
             $path = explode("/", $url, 2);
             $this->path = $path[1];
             $args = explode("@", $path[0], 2);
             if (isset($args[1])) {
                 $serverInfo = $args[1];
                 $userInfo = $args[0];
                 $userInfo = explode(":", $userInfo, 2);
                 $this->username = $userInfo[0];
             } else {
                 $serverInfo = $args[0];
             }
             $serverInfo = explode(":", $serverInfo, 2);
             $this->hostname = $serverInfo[0];
             if (isset($serverInfo[1])) {
                 $this->port = $serverInfo[1];
             }
             //deffer password lookups until after we have everything else
             if (isset($userInfo[1])) {
                 $this->password = $userInfo[1];
             } else {
                 $entries = $Auth->filter(array("appid" => 0, "server" => get_class($this) . "://" . $this->hostname . ":" . $this->port, "username" => $this->username, "userid" => $user->id));
                 if (isset($entries[0])) {
                     $blowfish = Crypt_Blowfish::factory("ecb");
                     $blowfish->setKey($GLOBALS['conf']['salt']);
                     $this->password = trim($blowfish->decrypt($entries[0]->password));
                 }
             }
             if ($_POST['login'] && $_POST['login'] != "undefined") {
                 $info = Zend_Json::decode($_POST['login']);
                 $this->password = $info['password'];
                 if ($info["remember"] == "forever") {
                     //remember the password
                     $entries = $Auth->filter(array("appid" => 0, "server" => get_class($this) . "://" . $this->hostname . ":" . $this->port, "username" => $this->username, "userid" => $user->id));
                     //get encryption stuff going
                     $blowfish = Crypt_Blowfish::factory("ecb");
                     $blowfish->setKey($GLOBALS['conf']['salt']);
                     if (!$entries[0]) {
                         //create
                         $entry = new $Auth(array("appid" => 0, "server" => get_class($this) . "://" . $this->hostname . ":" . $this->port, "username" => $this->username, "userid" => $user->id, "password" => $blowfish->encrypt($info["password"])));
                     } else {
                         //update
                         $entry = $entries[0];
                         $entry->password = $blowfish->encrypt($info["password"]);
                     }
                     $entry->save();
                 }
             }
         }
     }
     $this->_startup();
 }