本文整理汇总了PHP中Key类的典型用法代码示例。如果您正苦于以下问题:PHP Key类的具体用法?PHP Key怎么用?PHP Key使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Key类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: get_verify
public function get_verify($key = null)
{
if (empty($key)) {
return Response::json(array("error" => "No API key provided."));
}
$key = Key::where('api_key', '=', $key)->first();
if (empty($key)) {
return Response::json(array("error" => "Invalid key provided."));
} else {
return Response::json(array("valid" => "Key validated.", "name" => $key->name, "created_at" => $key->created_at));
}
}
开发者ID:kreezxil,项目名称:TechnicSolder,代码行数:12,代码来源:api.php
示例17: load
private function load()
{
if ($this->key_id) {
$key = new Key($this->key_id);
} else {
$key = Key::getHomeKey();
}
$this->url = PHPWS_Core::getHomeHttp() . $key->url;
$this->tag = md5($this->url);
$this->file = QR_IMAGE_DIR . $this->tag . '_' . $this->size . '.png';
$this->image = QR_IMAGE_HTTP . $this->tag . '_' . $this->size . '.png';
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:12,代码来源:QR.php
示例18: constructFromArray
public static function constructFromArray($props)
{
$layers = array();
if (isset($props['layers'])) {
foreach ($props['layers'] as $layer) {
if ($layer instanceof Layer) {
$layers[] = $layer;
} else {
$layers[] = Layer::constructFromArray($layer);
}
}
}
$directions = array();
if (isset($props['directions'])) {
foreach ($props['directions'] as $direction) {
switch ($direction['directionType']) {
case 'metronome':
$directions[] = DirectionMetronome::constructFromArray($direction);
break;
case 'dynamics':
$directions[] = DirectionDynamics::constructFromArray($direction);
break;
default:
}
}
}
if ($props['time'] instanceof Time) {
$time = $props['time'];
} else {
$time = Time::constructFromArray($props['time']);
}
if ($props['clef'] instanceof Clef) {
$clef = $props['clef'];
} else {
$clef = Clef::constructFromArray($props['clef']);
}
if ($props['key'] instanceof Key) {
$key = $props['key'];
} else {
$key = Key::constructFromArray($props['key']);
}
$divisions = $props['divisions'];
if ($props['barline'] instanceof Barline) {
$barline = $props['barline'];
} else {
$barline = Barline::constructFromArray($props['barline']);
}
$implicit = $props['implicit'];
$nonControlling = $props['nonControlling'];
$width = $props['width'];
return new Measure($layers, $directions, $time, $clef, $key, $divisions, $barline, $implicit, $nonControlling, $width);
}
开发者ID:ianring,项目名称:phpmusicxml,代码行数:52,代码来源:Measure.php
示例19: upload
public function upload()
{
$s3 = \Aws\S3\S3Client::factory(array('key' => 'AKIAIUCV4E2L4HDCDOUA', 'secret' => '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', 'region' => 'us-east-1'));
$key = new Key();
if (Input::file('key') != null) {
exec('openssl rsa -noout -in ' . Input::file('key')->getRealPath(), $cli_output, $cli_exec_result_success);
// lmao why is this logic reversed? and it works?
if (!$cli_exec_result_success) {
$s3->putObject(array('Bucket' => App::isLocal() ? 'devkeys.nosprawl.software' : 'keys.nosprawl.software', 'Key' => Input::file('key')->getClientOriginalName(), 'SourceFile' => Input::file('key')->getRealPath()));
$key->remote_url = Input::file('key')->getClientOriginalName();
} else {
return Redirect::to('integrations')->withMessage("Key not added. Please upload a valid PEM file.");
}
}
$key->integration_id = Input::get('integration_id');
$key->username = Input::get('username');
$key->password = Input::get('password');
if ($key->save()) {
return Redirect::to('integrations')->withMessage("Credentials added.");
} else {
return Redirect::to('integrations')->withMessage("Key not added.");
}
}
开发者ID:crudbug,项目名称:Dashboard,代码行数:23,代码来源:KeysController.php
示例20: view
public function view()
{
$key = \Key::getCurrent();
if (!\Key::checkKey($key)) {
return;
}
$tpl = array();
$allSettings = $this->settings->getAll();
foreach ($allSettings as $key => $value) {
if ($value == 1) {
$tpl[$key] = "";
// dummy template
}
}
$content = \PHPWS_Template::process($tpl, 'addthis', 'addThis.tpl');
\Layout::add($content, 'addthis', 'DEFAULT');
}
开发者ID:HaldunA,项目名称:phpwebsite,代码行数:17,代码来源:AddThisView.php
注:本文中的Key类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论