當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。