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


PHP Encrypter::supported方法代码示例

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


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

示例1: getEncrypterForKeyAndCipher

 /**
  * Get the proper encrypter instance for the given key and cipher.
  *
  * @param  string  $key
  * @param  string  $cipher
  * @return mixed
  *
  * @throws \RuntimeException
  */
 protected function getEncrypterForKeyAndCipher($key, $cipher)
 {
     if (Encrypter::supported($key, $cipher)) {
         return new Encrypter($key, $cipher);
     } elseif (McryptEncrypter::supported($key, $cipher)) {
         return new McryptEncrypter($key, $cipher);
     } else {
         throw new RuntimeException('No supported encrypter found. The cipher and / or key length are invalid.');
     }
 }
开发者ID:Penderis,项目名称:penderis.co.za,代码行数:19,代码来源:EncryptionServiceProvider.php

示例2: getEncrypter

 private static function getEncrypter()
 {
     $config = static::getEncrypterVariables();
     $key = $config['key'];
     $cipher = $config['cipher'];
     if (Encrypter::supported($key, $cipher)) {
         return new Encrypter($key, $cipher);
     } elseif (McryptEncrypter::supported($key, $cipher)) {
         return new McryptEncrypter($key, $cipher);
     } else {
         throw new RuntimeException('No supported encrypter found. The cipher and / or key length are invalid.');
     }
 }
开发者ID:DraperStudio,项目名称:Laravel-Database,代码行数:13,代码来源:EncryptAttributes.php

示例3: register

 /**
  * Register the service provider.
  *
  * @return void
  */
 public function register()
 {
     $this->app->singleton('encrypter', function ($app) {
         $config = $app->make('config')->get('app');
         $key = $config['key'];
         $cipher = $config['cipher'];
         if (Encrypter::supported($key, $cipher)) {
             return new Encrypter($key, $cipher);
         } elseif (McryptEncrypter::supported($key, $cipher)) {
             return new McryptEncrypter($key, $cipher);
         } else {
             throw new RuntimeException('No supported encrypter found. The cipher and / or key length are invalid.');
         }
     });
 }
开发者ID:ngitimfoyo,项目名称:Nyari-AppPHP,代码行数:20,代码来源:EncryptionServiceProvider.php

示例4: supported

 /**
  * Determine if the given key and cipher combination is valid.
  *
  * @param string $key
  * @param string $cipher
  * @return bool 
  * @static 
  */
 public static function supported($key, $cipher)
 {
     return \Illuminate\Encryption\Encrypter::supported($key, $cipher);
 }
开发者ID:satriashp,项目名称:tour,代码行数:12,代码来源:_ide_helper.php

示例5: setupEncryptionKey

 protected function setupEncryptionKey($force = false)
 {
     $validKey = false;
     $cipher = Config::get('app.cipher');
     $keyLength = $this->getKeyLength($cipher);
     $randomKey = $this->getRandomKey($cipher);
     if ($force) {
         $key = $randomKey;
     } else {
         $this->line(sprintf('Enter a new value of %s characters, or press ENTER to use the generated key', $keyLength));
         while (!$validKey) {
             $key = $this->ask('Application key', $randomKey);
             $validKey = Encrypter::supported($key, $cipher);
             if (!$validKey) {
                 $this->error(sprintf('[ERROR] Invalid key length for "%s" cipher. Supplied key must be %s characters in length.', $cipher, $keyLength));
             }
         }
     }
     $this->writeToConfig('app', ['key' => $key]);
     $this->info(sprintf('Application key [%s] set successfully.', $key));
 }
开发者ID:aaronleslie,项目名称:aaronunix,代码行数:21,代码来源:OctoberInstall.php


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