当前位置: 首页>>代码示例>>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;未经允许,请勿转载。