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


PHP Key類代碼示例

本文整理匯總了PHP中Key的典型用法代碼示例。如果您正苦於以下問題:PHP Key類的具體用法?PHP Key怎麽用?PHP Key使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: I18nRouter

 /**
  * Construcctor de I18nRouter
  * llena $__routes y crea la instancia del modelo que se encarga de interpretar las rutas
  * @access public
  * @return void
  */
 function I18nRouter()
 {
     $this->__setLocale();
     $this->__resortLangs();
     $key = new Key();
     $this->__urlsKey = $key->getUrls();
 }
開發者ID:roae,項目名稱:hello-world,代碼行數:13,代碼來源:i18n_router.php

示例2: test_not_mandatory_extra_validator_should_pass_with_absent_key

 public function test_not_mandatory_extra_validator_should_pass_with_absent_key()
 {
     $subValidator = new Length(1, 3);
     $validator = new Key('bar', $subValidator, false);
     $obj = array();
     $this->assertTrue($validator->validate($obj));
 }
開發者ID:vituhugo,項目名稱:webservice,代碼行數:7,代碼來源:KeyTest.php

示例3: getSharedSecret

 /**
  * Diffie-Hellman, ECDHE, etc.
  * 
  * Get a shared secret from a private key you possess and a public key for
  * the intended message recipient
  * 
  * @param EncryptionSecretKey $privateKey
  * @param EncryptionPublicKey $publicKey
  * @param bool $get_as_object Get as a Key object?
  * @return string
  */
 public static function getSharedSecret(Key $privateKey, Key $publicKey, bool $get_as_object = false)
 {
     if ($get_as_object) {
         return new EncryptionKey(\Sodium\crypto_scalarmult($privateKey->getRawKeyMaterial(), $publicKey->getRawKeyMaterial()));
     }
     return \Sodium\crypto_scalarmult($privateKey->getRawKeyMaterial(), $publicKey->getRawKeyMaterial());
 }
開發者ID:AndrewCarterUK,項目名稱:halite,代碼行數:18,代碼來源:Crypto.php

示例4: testNotMandatoryExtraValidatorShouldPassWithAbsentKey

 public function testNotMandatoryExtraValidatorShouldPassWithAbsentKey()
 {
     $subValidator = new Length(1, 3);
     $validator = new Key('bar', $subValidator, false);
     $obj = array();
     $this->assertTrue($validator->validate($obj));
 }
開發者ID:gawonmi,項目名稱:Validation,代碼行數:7,代碼來源:KeyTest.php

示例5: assert_that_key_usage_check_works_correctly

 /**
  * @group certificate
  *
  * @test
  */
 public function assert_that_key_usage_check_works_correctly()
 {
     $key = new Key(array(Key::USAGE_SIGNING => true));
     $this->assertTrue($key->canBeUsedFor(Key::USAGE_SIGNING));
     $this->assertFalse($key->canBeUsedFor(Key::USAGE_ENCRYPTION));
     $key[Key::USAGE_ENCRYPTION] = false;
     $this->assertFalse($key->canBeUsedFor(Key::USAGE_ENCRYPTION));
 }
開發者ID:SysBind,項目名稱:saml2,代碼行數:13,代碼來源:KeyTest.php

示例6: getKeys

 /** @return Key[] */
 public function getKeys()
 {
     $keys = [];
     $keysNames = $this->predis->smembers($this->getKeyName("tag:{$this->key}"));
     foreach ($keysNames as $key) {
         $k = new Key($this->predis, $key);
         $k->setKeyPrefix($this->keyPrefix);
         $keys[] = $k;
     }
     return $keys;
 }
開發者ID:jimbojsb,項目名稱:cacheback,代碼行數:12,代碼來源:Tag.php

示例7: up

 /**
  * Make changes to the database.
  *
  * @return void
  */
 public function up()
 {
     Schema::create('keys', function ($table) {
         $table->increments('id');
         $table->string('name');
         $table->string('api_key');
         $table->timestamps();
     });
     $key = new Key();
     $key->name = "default";
     $key->api_key = Config::get('solder.platform_key');
     $key->save();
 }
開發者ID:kreezxil,項目名稱:TechnicSolder,代碼行數:18,代碼來源:2014_01_24_122845_create_keys_table.php

示例8: __construct

 /**
  * @param array $keys
  */
 public function __construct(array $keys)
 {
     if (!empty($keys)) {
         foreach ($keys as $value) {
             $key = new Key();
             $key->setKey(isset($value['key']) ? $value['key'] : null);
             $key->setValue(isset($value['value']) ? $value['value'] : null);
             $key->setCas(isset($value['cas']) ? $value['cas'] : null);
             $this->addKey($value['key'], $key);
         }
         //sort the keys
         ksort($this->keys);
     }
 }
開發者ID:fraserreed,項目名稱:memcached-manager,代碼行數:17,代碼來源:KeyStore.php

示例9: assert_that_offsetunset_unsets_offset

 /**
  * @group certificate
  *
  * @test
  */
 public function assert_that_offsetunset_unsets_offset()
 {
     $key = new Key(array(Key::USAGE_SIGNING => true, Key::USAGE_ENCRYPTION => true));
     $this->assertTrue($key->offsetExists(Key::USAGE_SIGNING));
     $this->assertTrue($key->offsetExists(Key::USAGE_ENCRYPTION));
     $key->offsetUnset(Key::USAGE_SIGNING);
     $this->assertFalse($key->offsetExists(Key::USAGE_SIGNING));
     $this->assertTrue($key->offsetExists(Key::USAGE_ENCRYPTION));
     $key->offsetUnset(Key::USAGE_ENCRYPTION);
     $this->assertFalse($key->offsetExists(Key::USAGE_SIGNING));
     $this->assertFalse($key->offsetExists(Key::USAGE_ENCRYPTION));
 }
開發者ID:rediris-es,項目名稱:saml2,代碼行數:17,代碼來源:KeyTest.php

示例10: showFP

function showFP()
{
    $db = new PHPWS_DB('ps_page');
    $db->addWhere('front_page', 1);
    if ($db->isTableColumn('deleted')) {
        $db->addWhere('deleted', 0);
    }
    Key::restrictView($db, 'pagesmith');
    $db->loadClass('pagesmith', 'PS_Page.php');
    $result = $db->getObjects('PS_Page');
    if (!PHPWS_Error::logIfError($result) && !empty($result)) {
        PHPWS_Core::initModClass('pagesmith', 'PageSmith.php');
        foreach ($result as $page) {
            $content = $page->view();
            if ($content && !PHPWS_Error::logIfError($content)) {
                if (Current_User::allow('pagesmith', 'edit_page', $page->id)) {
                    $content .= sprintf('<p class="pagesmith-edit">%s</p>', $page->editLink());
                }
                Layout::add($content, 'pagesmith', 'view_' . $page->id, TRUE);
            }
        }
    } else {
        return null;
    }
}
開發者ID:HaldunA,項目名稱:phpwebsite,代碼行數:25,代碼來源:runtime.php

示例11: testMultiChangePassword

 public function testMultiChangePassword()
 {
     $firstPassword = 'hello world';
     $secondPassword = 'goodbye sun';
     $otpKey = 'I am a test key';
     $data = openssl_random_pseudo_bytes(117);
     // Set up a user
     $user = new User();
     $user->setOtpKey($otpKey, $firstPassword);
     // Setup a key
     $defaultKeyPassphrase = $user->dangerouslyRegenerateAccountKeyPassphrase($firstPassword);
     $key = Key::generate($defaultKeyPassphrase, 1024);
     $user->accountKey = $key;
     // Encrypt some data
     $encryptedData = $user->getAccountKey()->encrypt($data);
     // Change user's password
     // This must update the password on the default key and OTP key as well
     $user->changePassword($firstPassword, $secondPassword);
     // Decrypt data
     $newKeyPassphrase = $user->getAccountKeyPassphrase($secondPassword);
     $decrypted = $user->getAccountKey()->decrypt($encryptedData, $newKeyPassphrase);
     // Default Key passphrase should have changed and remain valid
     $this->assertNotEquals($newKeyPassphrase, $defaultKeyPassphrase);
     $this->assertEquals($data, $decrypted);
     // OTP key should have been encrypted with the new password
     $this->assertEquals($otpKey, $user->getOtpKey($secondPassword));
 }
開發者ID:stecman,項目名稱:passnote,代碼行數:27,代碼來源:UserTest.php

示例12: Create

 public static function Create($Key = 0, $Company = false)
 {
     $Return = false;
     if ($Key !== 0) {
         if (\Session::exists("refKey")) {
             if (\Session::get("refKey") != $Key) {
                 //This computer has multiple Keys? I'm not sure how or why this would happen.
                 //It is a possibility so I guess I should probably plan for it
                 $SavedKey = new Key(\Session::get("refKey"));
                 if ($SavedKey->validKey()) {
                     //Has two valid keys? What on earth? I will have to account for this later
                 } else {
                     \Session::put("refKey", $Key);
                     $Return = true;
                 }
             }
         } else {
             \Session::put("refKey", $Key);
             $Return = true;
         }
         if (\Cookie::exists("refKey")) {
             if (\Cookie::get("refKey") != $Key) {
                 $SavedKey = new Key(\Cookie::get("refKey"));
                 if ($SavedKey->validKey()) {
                     //Has two valid keys? What on earth? I will have to account for this later
                 } else {
                     \Cookie::put("refKey", $Key, \Config::get("tracking/cookie_expiry"));
                     $Return = true;
                 }
             }
         } else {
             \Cookie::put("refKey", $Key, \Config::get("tracking/cookie_expiry"));
             $Return = true;
         }
         if ($Company != false) {
             if (count(\DB::getInstance()->table("companyip")->where("IP", \Connection::IP())->where("Company", $Company->ID())) == 0) {
                 \DB::getInstance()->table("companyip")->insert(array("IP" => \Connection::IP(), "Company" => $Company->ID(), "LastScene" => \Time::get(), "Hits" => 1));
             } else {
                 \DB::getInstance()->table("companyip")->where("IP", \Connection::IP())->increment("Hits");
             }
         }
         //IP Based Search will go here
         return $Return;
     }
     return false;
 }
開發者ID:25564,項目名稱:Resume,代碼行數:46,代碼來源:Tracker.php

示例13: getUserKeys

 /**
  * Get a map of id => name for the keys belonging to $this->user
  *
  * @return array
  */
 protected function getUserKeys()
 {
     $keyMap = [];
     $keys = Key::find(['user_id = :user_id:', 'bind' => ['user_id' => $this->user->id]]);
     foreach ($keys as $key) {
         $keyMap[$key->id] = $key->name;
     }
     return $keyMap;
 }
開發者ID:stecman,項目名稱:passnote,代碼行數:14,代碼來源:ObjectForm.php

示例14: action_do_delete

 public function action_do_delete($key_id)
 {
     $key = Key::find($key_id);
     if (empty($key)) {
         return Redirect::back();
     }
     $key->delete();
     return Redirect::to('key/list')->with('success', 'API Key deleted!');
 }
開發者ID:kreezxil,項目名稱:TechnicSolder,代碼行數:9,代碼來源:key.php

示例15: postDelete

 public function postDelete($key_id)
 {
     $key = Key::find($key_id);
     if (empty($key)) {
         return Redirect::to('key/list')->withErrors(new MessageBag(array('Platform Key not found')));
     }
     $key->delete();
     Cache::forget('keys');
     return Redirect::to('key/list')->with('success', 'API Key deleted!');
 }
開發者ID:jensz12,項目名稱:TechnicSolder,代碼行數:10,代碼來源:KeyController.php


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