亚洲免费乱码视频,日韩 欧美 国产 动漫 一区,97在线观看免费视频播国产,中文字幕亚洲图片

      1. <legend id="ppnor"></legend>

      2. 
        
        <sup id="ppnor"><input id="ppnor"></input></sup>
        <s id="ppnor"></s>

        uc_server增加aes加密保護敏感信息

        字號:


            對uc_server做了很多的二次擴展,對敏感信息進行了加密處理,其中采用了AES方法加的密,把修改方法分享如下
            基于當前數(shù)據(jù)庫安全問題岌岌可危的情形,對于數(shù)據(jù)庫中的敏感信息進行加密顯得尤為重要了。由于必要的需求,對uc_server做了很多的二次擴展,也增加了一些需要保護的敏感信息。因此,再次對于敏感信息進行了加密處理,其中采用了AES方法。
            方法如下:
            修改 model/base.php,在 class base 類的最后面增加如下代碼
            代碼如下:
            /**
            * 獲得AES密鑰以及創(chuàng)建初始化向量(IV)
            */
            private function aes_key_iv($uid=0, $addition='AES-JIAMI-SEA-IMAIJ', $is_iv=false)
            {
            $hash_str = &quot;AES-ASEE-{$uid}-SEAAA-{$addition}&quot;.($is_iv===false ? &quot;&quot; : &quot;-AESIV-{$uid}-VISEA&quot;);
            $salt = $is_iv===false ? &quot;KJLHKHGMSBFYGHVGGTHBG56265&quot; : &quot;GJVGKGTIHGKNBK&lt;HGKOGLNFFL4793467&quot;;
            return md5($salt.md5($hash_str));
            }
            /**
            * 執(zhí)行AES加密,強制使用 MCRYPT_RIJNDAEL_256
            */
            function aes_encrypt($data=&quot;artxun_aes&quot;, $uid=0, $addition='AES-JIAMI-SEA-MIJIA-IMAIJ')
            {
            $cipher = MCRYPT_RIJNDAEL_256; //強制使用AES 256此算法
            $key = $this-&gt;aes_key_iv($uid, $addition, $is_iv=false);
            $iv = $this-&gt;aes_key_iv($uid, $addition, $is_iv=true);
            $mode = MCRYPT_MODE_CBC; //強制使用加密塊模式
            $aes_result = mcrypt_encrypt($cipher, $key, $data, $mode, $iv);
            $aes_result = @bin2hex($aes_result);
            return $aes_result;
            }
            /**
            * 執(zhí)行AES加密,強制使用 MCRYPT_RIJNDAEL_256
            */
            function aes_decrypt($data=&quot;&quot;, $uid=0, $addition='AES-JIEMI-SEA-MIJIE-IMEIJ')
            {
            $data = trim(strip_tags($data));
            if (empty($data) || <a href="mailto:!@preg_match(&quot;~^[0-9a-fA-F]+$~is&quot">!@preg_match(&quot;~^[0-9a-fA-F]+$~is&quot</a>;, $data))
            {
            return false;
            }
            $cipher = MCRYPT_RIJNDAEL_256; //強制使用AES 256此算法
            $key = $this-&gt;aes_key_iv($uid, $addition, $is_iv=false);
            $iv = $this-&gt;aes_key_iv($uid, $addition, $is_iv=true);
            $mode = MCRYPT_MODE_CBC; //強制使用加密塊模式
            $data = @pack(&quot;H*&quot;, $data);
            $aes_result = mcrypt_decrypt($cipher, $key, $data, $mode, $iv);
            $aes_result = str_replace(&quot;&#92;&#48;&quot;, '', $aes_result);
            return $aes_result;
            }