當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Crypt_AES::decrypt方法代碼示例

本文整理匯總了PHP中Crypt_AES::decrypt方法的典型用法代碼示例。如果您正苦於以下問題:PHP Crypt_AES::decrypt方法的具體用法?PHP Crypt_AES::decrypt怎麽用?PHP Crypt_AES::decrypt使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Crypt_AES的用法示例。


在下文中一共展示了Crypt_AES::decrypt方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: seeMessageInResponse

 public function seeMessageInResponse($message)
 {
     $response = $this->getModule('REST')->response;
     $response = json_decode($response);
     $data = base64_url_decode($response->data);
     $data = $this->aes->decrypt($data);
     file_put_contents('./dump.txt', $data);
     $data = json_decode($data);
     $this->assertEquals($message, $data->message);
 }
開發者ID:amegatron,項目名稱:cryptoapi,代碼行數:10,代碼來源:CryptoApiHelper.php

示例2: get_message

 public function get_message($message)
 {
     $key = $this->key;
     if ($message) {
         $message = @base64_decode($message);
         if ($message) {
             $message = @unserialize($message);
             if ($message) {
                 $cipher = new \Crypt_AES(CRYPT_AES_MODE_ECB);
                 $cipher->setPassword($key, 'pbkdf2', 'sha256', $message['s'], 1000);
                 if (@gmmktime() - $message['t'] > self::MAX_AGE) {
                     return false;
                 }
                 $message = $cipher->decrypt($message['p']);
                 if ($message) {
                     $message = @unserialize($message);
                     if ($message) {
                         return $message;
                     }
                 }
             }
         }
     }
     return false;
 }
開發者ID:SkyFire-Lee,項目名稱:x7chat,代碼行數:25,代碼來源:api.php

示例3: symmetricDecrypt

 /**
  * Decrypts AES encrypted data
  * @param String $data Data to decrypt
  * @return String
  */
 public function symmetricDecrypt($data)
 {
     if (!$this->isAesInitialized) {
         $this->initSymmetric();
     }
     return $this->aes->decrypt($data);
 }
開發者ID:tiagogoddard,項目名稱:cryptoapi,代碼行數:12,代碼來源:RsaAesCryptography.php

示例4: AESDecrypt

function AESDecrypt($ciphertext, $key, $IV)
{
    $aes = new Crypt_AES(CRYPT_MODE_ECB);
    $aes->setKey(characet($key));
    $aes->setIV(characet($IV));
    return $aes->decrypt(hex2bin($ciphertext));
}
開發者ID:abcdlzy,項目名稱:webshell-manager,代碼行數:7,代碼來源:common.php

示例5: _pugpig_bbappworld_decrypt

function _pugpig_bbappworld_decrypt($base64_encrypted, $password)
{
    $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
    // keys are null-padded to the closest valid size
    // longer than the longest key and it's truncated
    $cipher->setKey($password);
    return $cipher->decrypt(base64_decode($base64_encrypted));
}
開發者ID:shortlist-digital,項目名稱:agreable-pugpig-plugin,代碼行數:8,代碼來源:pugpig_subs_bbappword.php

示例6: decodeResponse

 protected function decodeResponse($received)
 {
     $aes = new Crypt_AES();
     $aes->setKey($this->key);
     $data = $aes->decrypt(base64_decode(substr($received, 28)));
     $decoder = new XmlrpcDecoder();
     return $decoder->decodeResponse($data);
 }
開發者ID:comodojo,項目名稱:rpcserver,代碼行數:8,代碼來源:XmlRpcEncryptedTransportTest.php

示例7: decryptAES

 /**
  * Decrypt the provided data using AES cryptography with the provided key and IV
  *
  * @param string $data Data to decrypt
  * @param string $key Cipher key used to encrypt the data
  * @param string $iv IV used to encrypt the data
  * @param bool $base64Encoded Is the provided data Base64 encoded (defaults to true)
  * @return string Unencrypted data
  */
 public function decryptAES($data, $key, $iv, $base64Encoded = true)
 {
     $data = $base64Encoded ? base64_decode($data) : $data;
     $cipher = new \Crypt_AES();
     $cipher->setKey($key);
     $cipher->setIV($iv);
     $cipher->disablePadding();
     $decrypted = rtrim($cipher->decrypt($data));
     return $decrypted;
 }
開發者ID:ThemeSurgeon,項目名稱:launchkey-php,代碼行數:19,代碼來源:PhpSecLibCryptService.php

示例8: testEncryptDecryptWithContinuousBuffer

 /**
  * @dataProvider continuousBufferCombos
  */
 public function testEncryptDecryptWithContinuousBuffer($mode, $plaintext, $iv, $key)
 {
     $aes = new Crypt_AES(constant($mode));
     $aes->enableContinuousBuffer();
     $aes->setIV($iv);
     $aes->setKey($key);
     $actual = '';
     for ($i = 0, $strlen = strlen($plaintext); $i < $strlen; ++$i) {
         $actual .= $aes->decrypt($aes->encrypt($plaintext[$i]));
     }
     $this->assertEquals($plaintext, $actual);
 }
開發者ID:TheTypoMaster,項目名稱:SPHERE-Framework,代碼行數:15,代碼來源:TestCase.php

示例9: decrypt

 public static function decrypt($secret, $password, ApiKeyEncryptionOptions $options)
 {
     $decodedSecret = self::base64url_decode($secret);
     $salt = self::base64url_decode($options->getEncryptionKeySalt());
     $iterations = $options->getEncryptionKeyIterations();
     $keyLengthBits = $options->getEncryptionKeySize();
     $iv = substr($decodedSecret, 0, 16);
     $aes = new \Crypt_AES();
     $aes->setPassword($password, 'pbkdf2', 'sha1', $salt, $iterations, $keyLengthBits / 8);
     $aes->setKeyLength($keyLengthBits);
     $aes->setIV($iv);
     return $aes->decrypt(substr($decodedSecret, 16));
 }
開發者ID:InfinityCCS,項目名稱:stormpath-sdk-php,代碼行數:13,代碼來源:ApiKeyEncryptionUtils.php

示例10: fileRead

function fileRead($key)
{
    $file = fopen("data.php", "r");
    $aes = new Crypt_AES();
    $aes->setKey($key);
    $tempdata = "";
    if ($file) {
        $tempdata = file_get_contents("data.php");
        $tempdata = substr($tempdata, strlen($GLOBALS["fileStart"]));
        $tempdata = $aes->decrypt(substr($tempdata, 0, -strlen($GLOBALS["fileEnd"])));
    }
    fclose($file);
    return $tempdata;
}
開發者ID:abcdlzy,項目名稱:webshell-manager,代碼行數:14,代碼來源:DataOperator.php

示例11: post_get_option_filter

 /**
  * Process the launchkey option to prepare for usage within the plugin.  The option will have encrypted attributes
  * decrypted as well as set default values for any missing or unset attributes.
  *
  * @since 1.0.0
  *
  * @param $input
  *
  * @return array
  */
 public function post_get_option_filter($input)
 {
     // Define the defaults for attributes
     $defaults = static::get_defaults();
     // If the input is empty (null) set it to an empty array
     $input ?: array();
     // Merge the input array over the defaults array to set any know data to the response
     $output = array_merge($defaults, $input);
     // If the secret key attribute is not empty, decrypt it
     if (!empty($input[LaunchKey_WP_Options::OPTION_SECRET_KEY])) {
         $key = md5($input[LaunchKey_WP_Options::OPTION_SECRET_KEY]);
         if (empty($this->cache[$key])) {
             /**
              * Use the rocket key as the IV. If null, use the static value.
              * @link https://docs.launchkey.com/glossary.html#term-iv
              */
             $iv = empty($output[LaunchKey_WP_Options::OPTION_ROCKET_KEY]) ? static::STATIC_IV : $output[LaunchKey_WP_Options::OPTION_ROCKET_KEY];
             $this->crypt_aes->setIV($iv);
             /**
              * Decrypt the Base64 decoded string and set it as the output value
              * @link https://docs.launchkey.com/glossary.html#term-base64
              */
             $this->cache[$key] = $this->crypt_aes->decrypt(base64_decode($input[LaunchKey_WP_Options::OPTION_SECRET_KEY]));
         }
         $output[LaunchKey_WP_Options::OPTION_SECRET_KEY] = $this->cache[$key];
     }
     // If the private key attribute is not empty, decrypt it
     if (!empty($input[LaunchKey_WP_Options::OPTION_PRIVATE_KEY])) {
         $key = md5($input[LaunchKey_WP_Options::OPTION_PRIVATE_KEY]);
         if (empty($this->cache[$key])) {
             /**
              * Use the decrypted secret key as the IV. If null, use the static value.
              * @link https://docs.launchkey.com/glossary.html#term-iv
              */
             $iv = empty($output[LaunchKey_WP_Options::OPTION_SECRET_KEY]) ? static::STATIC_IV : $output[LaunchKey_WP_Options::OPTION_SECRET_KEY];
             $this->crypt_aes->setIV($iv);
             /**
              * Decrypt the Base64 decoded string and set it as the output value
              * @link https://docs.launchkey.com/glossary.html#term-base64
              *
              * We are suppressing errors as
              */
             $this->cache[$key] = @$this->crypt_aes->decrypt(base64_decode($input[LaunchKey_WP_Options::OPTION_PRIVATE_KEY]));
         }
         $output[LaunchKey_WP_Options::OPTION_PRIVATE_KEY] = $this->cache[$key];
     }
     return $output;
 }
開發者ID:ThemeSurgeon,項目名稱:launchkey-wordpress,代碼行數:58,代碼來源:class-launchkey-wp-options.php

示例12: pac_message_receiver

 public function pac_message_receiver()
 {
     $content = Req::post("content");
     if (!isset($content)) {
         $this->returnXML("false", "S09", "返回報文為空");
     }
     $signature = Req::post("data_digest");
     if (!isset($signature)) {
         $this->returnXML("false", "S09", "返回報文為空");
     }
     Tiny::log("異步審批結果回執信息【content:" . $content . "】data_digest【" . $signature . "】");
     // 測試密鑰
     $aeskey = base64_decode($this->jkf['aes_key']);
     //AES解密,采用ECB模式
     $aes = new Crypt_AES(CRYPT_MODE_ECB);
     //設置AES密鑰
     $aes->setKey($aeskey);
     //解密AES密文
     $plaintext = $aes->decrypt(base64_decode($content));
     //測試rsa公鑰
     $publickey = $this->jkf['public_key'];
     $rsa = new Crypt_RSA();
     //設置RSA簽名模式 CRYPT_RSA_SIGNATURE_PSS or CRYPT_RSA_SIGNATURE_PKCS1
     $rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
     //使用RSA公鑰驗證簽名
     $rsa->loadKey(base64_decode($publickey));
     //簽名通過
     if ($rsa->verify($plaintext, base64_decode($signature))) {
         $contentXML = simplexml_load_string($plaintext);
         $businessType = (string) $contentXML->head->businessType;
         $model = new GatewayModel();
         if ($businessType == "RESULT") {
             $model->insertResult($contentXML, "1");
         } else {
             if ($businessType == "PRODUCT_RECORD") {
                 $model->insertExamineResult($contentXML);
             }
         }
         $this->returnXML();
     } else {
         $this->returnXML("false", "S02", "非法的數字簽名");
     }
 }
開發者ID:sammychan1981,項目名稱:quanpin,代碼行數:43,代碼來源:gateway.php

示例13: blowfishDecrypt

 /**
  * Decryption using blowfish algorithm (mcrypt)
  * or phpseclib's AES if mcrypt not available
  *
  * @param string $encdata encrypted data
  * @param string $secret  the secret
  *
  * @return string original data
  */
 public function blowfishDecrypt($encdata, $secret)
 {
     global $iv;
     if (!function_exists('mcrypt_encrypt')) {
         include_once "./libraries/phpseclib/Crypt/AES.php";
         $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
         $cipher->setKey($secret);
         return $cipher->decrypt(base64_decode($encdata));
     } else {
         $data = base64_decode($encdata);
         $decrypted = mcrypt_decrypt(MCRYPT_BLOWFISH, $secret, $data, MCRYPT_MODE_CBC, $iv);
         return trim($decrypted);
     }
 }
開發者ID:roccivic,項目名稱:phpmyadmin,代碼行數:23,代碼來源:AuthenticationCookie.class.php

示例14: blowfishDecrypt

 /**
  * Decryption using blowfish algorithm (mcrypt)
  * or phpseclib's AES if mcrypt not available
  *
  * @param string $encdata encrypted data
  * @param string $secret  the secret
  *
  * @return string original data
  */
 public function blowfishDecrypt($encdata, $secret)
 {
     if (is_null($this->_blowfish_iv)) {
         $this->_blowfish_iv = base64_decode($_COOKIE['pma_mcrypt_iv'], true);
     }
     if (!function_exists('mcrypt_encrypt')) {
         include_once PHPSECLIB_INC_DIR . '/Crypt/AES.php';
         $cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
         $cipher->setKey($secret);
         return $cipher->decrypt(base64_decode($encdata));
     } else {
         $data = base64_decode($encdata);
         $decrypted = mcrypt_decrypt(MCRYPT_BLOWFISH, $secret, $data, MCRYPT_MODE_CBC, $this->_blowfish_iv);
         return trim($decrypted);
     }
 }
開發者ID:amigobv,項目名稱:chat,代碼行數:25,代碼來源:AuthenticationCookie.class.php

示例15: auth_decrypt

/**
 * Decrypt the given AES ciphertext
 *
 * The mode is CBC, the key is derived using pbkdf2
 *
 * @param string $ciphertext The encrypted data
 * @param string $secret     The secret/password that shall be used
 * @return string The decrypted data
 */
function auth_decrypt($ciphertext, $secret)
{
    $iv = substr($ciphertext, 0, 16);
    $cipher = new Crypt_AES();
    $cipher->setPassword($secret);
    $cipher->setIV($iv);
    return $cipher->decrypt(substr($ciphertext, 16));
}
開發者ID:amondot,項目名稱:dokuwiki_ynh,代碼行數:17,代碼來源:auth.php


注:本文中的Crypt_AES::decrypt方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。