当前位置: 首页>>代码示例>>PHP>>正文


PHP Crypto::aes128cbcDecrypt方法代码示例

本文整理汇总了PHP中Crypto::aes128cbcDecrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP Crypto::aes128cbcDecrypt方法的具体用法?PHP Crypto::aes128cbcDecrypt怎么用?PHP Crypto::aes128cbcDecrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Crypto的用法示例。


在下文中一共展示了Crypto::aes128cbcDecrypt方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: unwrap

 /**
  * {@inheritDoc}
  */
 public function unwrap($in, $maxAgeSec)
 {
     //TODO remove this once we have a better way to generate a fake token
     // in the example files
     if (Config::get('allow_plaintext_token') && count(explode(':', $in)) == 6) {
         $data = explode(":", $in);
         $out = array();
         $out['o'] = $data[0];
         $out['v'] = $data[1];
         $out['a'] = $data[2];
         $out['d'] = $data[3];
         $out['u'] = $data[4];
         $out['m'] = $data[5];
     } else {
         //TODO Exception handling like JAVA
         $bin = base64_decode($in);
         $cipherText = substr($bin, 0, strlen($bin) - Crypto::$HMAC_SHA1_LEN);
         $hmac = substr($bin, strlen($cipherText));
         Crypto::hmacSha1Verify($this->hmacKey, $cipherText, $hmac);
         $plain = Crypto::aes128cbcDecrypt($this->cipherKey, $cipherText);
         $out = $this->deserialize($plain);
         $this->checkTimestamp($out, $maxAgeSec);
     }
     return $out;
 }
开发者ID:jkinner,项目名称:ringside,代码行数:28,代码来源:BasicBlobCrypter.php

示例2: testAes128

 /**
  * Tests Crypto::aes128cbcEncrypt()
  */
 public function testAes128()
 {
     $string = 'Lorem ipsum dolor sit amet, consectetuer adipiscing elit';
     $key = 'Aliquam erat volutpat';
     $encrypted = Crypto::aes128cbcEncrypt($key, $string);
     $decrypted = Crypto::aes128cbcDecrypt($key, $encrypted);
     $this->assertEquals($decrypted, $string);
 }
开发者ID:ahmedadham88,项目名称:enhanced-social-network,代码行数:11,代码来源:CryptoTest.php

示例3: decrypt

 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));
 }
开发者ID:niryuu,项目名称:opOpenSocialPlugin,代码行数:10,代码来源:opShindigCrypto.class.php

示例4: unwrap

 /**
  * {@inheritDoc}
  */
 public function unwrap($in, $maxAgeSec)
 {
     //TODO remove this once we have a better way to generate a fake token in the example files
     if ($this->allowPlaintextToken && count(explode(':', $in)) >= 7) {
         //Parses the security token in the form st=o:v:a:d:u:m:c
         $data = $this->parseToken($in);
         $out = array();
         $out['o'] = $data[0];
         $out['v'] = $data[1];
         $out['a'] = $data[2];
         $out['d'] = $data[3];
         $out['u'] = $data[4];
         $out['m'] = $data[5];
     } else {
         $bin = base64_decode($in);
         if (is_callable('mb_substr')) {
             $cipherText = mb_substr($bin, 0, -Crypto::$HMAC_SHA1_LEN, 'latin1');
             $hmac = mb_substr($bin, mb_strlen($cipherText, 'latin1'), Crypto::$HMAC_SHA1_LEN, 'latin1');
         } else {
             $cipherText = substr($bin, 0, -Crypto::$HMAC_SHA1_LEN);
             $hmac = substr($bin, strlen($cipherText));
         }
         Crypto::hmacSha1Verify($this->hmacKey, $cipherText, $hmac);
         if (!function_exists('mcrypt_module_open') && $this->allowPlaintextToken) {
             $plain = base64_decode($cipherText);
         } else {
             $plain = Crypto::aes128cbcDecrypt($this->cipherKey, $cipherText);
         }
         $out = $this->deserialize($plain);
         $this->checkTimestamp($out, $maxAgeSec);
     }
     return $out;
 }
开发者ID:react-epfl,项目名称:moodle-shindig,代码行数:36,代码来源:BasicBlobCrypter.php

示例5: unwrap

 /**
  * {@inheritDoc}
  */
 public function unwrap($in, $maxAgeSec)
 {
     //TODO remove this once we have a better way to generate a fake token in the example files
     if ($this->allowPlaintextToken && count(explode(':', $in)) == 6) {
         $data = explode(":", $in);
         $out = array();
         $out['o'] = $data[0];
         $out['v'] = $data[1];
         $out['a'] = $data[2];
         $out['d'] = $data[3];
         $out['u'] = $data[4];
         $out['m'] = $data[5];
     } else {
         $bin = base64_decode($in);
         $cipherText = substr($bin, 0, strlen($bin) - Crypto::$HMAC_SHA1_LEN);
         $hmac = substr($bin, strlen($cipherText));
         Crypto::hmacSha1Verify($this->hmacKey, $cipherText, $hmac);
         if (!function_exists('mcrypt_module_open') && $this->allowPlaintextToken) {
             $plain = base64_decode($cipherText);
         } else {
             $plain = Crypto::aes128cbcDecrypt($this->cipherKey, $cipherText);
         }
         $out = $this->deserialize($plain);
         $this->checkTimestamp($out, $maxAgeSec);
     }
     return $out;
 }
开发者ID:dalinhuang,项目名称:shopexts,代码行数:30,代码来源:BasicBlobCrypter.php


注:本文中的Crypto::aes128cbcDecrypt方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。