本文整理汇总了PHP中Crypt_AES类的典型用法代码示例。如果您正苦于以下问题:PHP Crypt_AES类的具体用法?PHP Crypt_AES怎么用?PHP Crypt_AES使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Crypt_AES类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: AESDecrypt
function AESDecrypt($ciphertext, $key, $IV)
{
$aes = new Crypt_AES(CRYPT_MODE_ECB);
$aes->setKey(characet($key));
$aes->setIV(characet($IV));
return $aes->decrypt(hex2bin($ciphertext));
}
开发者ID:abcdlzy,项目名称:webshell-manager,代码行数:7,代码来源:common.php
示例2: cipher
private function cipher()
{
switch ($this->header['enc']) {
case 'A128GCM':
case 'A256GCM':
throw new JOSE_Exception_UnexpectedAlgorithm('Algorithm not supported');
case 'A128CBC-HS256':
case 'A256CBC-HS512':
$cipher = new Crypt_AES(CRYPT_AES_MODE_CBC);
break;
default:
throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm');
}
switch ($this->header['enc']) {
case 'A128GCM':
case 'A128CBC-HS256':
$cipher->setBlockLength(128);
break;
case 'A256GCM':
case 'A256CBC-HS512':
$cipher->setBlockLength(256);
break;
default:
throw new JOSE_Exception_UnexpectedAlgorithm('Unknown algorithm');
}
return $cipher;
}
开发者ID:nask0,项目名称:jose,代码行数:27,代码来源:JWE.php
示例3: _pugpig_bbappworld_decrypt
function _pugpig_bbappworld_decrypt($base64_encrypted, $password)
{
$cipher = new Crypt_AES(CRYPT_AES_MODE_ECB);
// keys are null-padded to the closest valid size
// longer than the longest key and it's truncated
$cipher->setKey($password);
return $cipher->decrypt(base64_decode($base64_encrypted));
}
开发者ID:shortlist-digital,项目名称:agreable-pugpig-plugin,代码行数:8,代码来源:pugpig_subs_bbappword.php
示例4: decodeResponse
protected function decodeResponse($received)
{
$aes = new Crypt_AES();
$aes->setKey($this->key);
$data = $aes->decrypt(base64_decode(substr($received, 28)));
$decoder = new XmlrpcDecoder();
return $decoder->decodeResponse($data);
}
开发者ID:comodojo,项目名称:rpcserver,代码行数:8,代码来源:XmlRpcEncryptedTransportTest.php
示例5: getApi
/**
* Returns an instance of the Crypto library
* @return Crypt_AES
*/
public function getApi()
{
if (is_null($this->api)) {
$this->api = new AES();
$this->api->setKey($this->getKey());
}
return $this->api;
}
开发者ID:hhgr,项目名称:hhgolf,代码行数:12,代码来源:Encrypt.php
示例6: decryptAES
/**
* Decrypt the provided data using AES cryptography with the provided key and IV
*
* @param string $data Data to decrypt
* @param string $key Cipher key used to encrypt the data
* @param string $iv IV used to encrypt the data
* @param bool $base64Encoded Is the provided data Base64 encoded (defaults to true)
* @return string Unencrypted data
*/
public function decryptAES($data, $key, $iv, $base64Encoded = true)
{
$data = $base64Encoded ? base64_decode($data) : $data;
$cipher = new \Crypt_AES();
$cipher->setKey($key);
$cipher->setIV($iv);
$cipher->disablePadding();
$decrypted = rtrim($cipher->decrypt($data));
return $decrypted;
}
开发者ID:ThemeSurgeon,项目名称:launchkey-php,代码行数:19,代码来源:PhpSecLibCryptService.php
示例7: testKeyPaddingAES
/**
* @group github451
*/
public function testKeyPaddingAES()
{
// same as the above - just with a different ciphertext
$aes = new Crypt_AES();
$aes->disablePadding();
$aes->setKey(pack('H*', '2b7e151628aed2a6abf7158809cf4f3c762e7160'));
// 160-bit key. AES should null pad to 192-bits
$ciphertext = $aes->encrypt(pack('H*', '3243f6a8885a308d313198a2e0370734'));
$this->assertEquals($ciphertext, pack('H*', 'c109292b173f841b88e0ee49f13db8c0'));
}
开发者ID:TheTypoMaster,项目名称:SPHERE-Framework,代码行数:13,代码来源:TestCase.php
示例8: create_message
public function create_message(model\api_message $message)
{
$payload = serialize($message);
$key = $this->key;
$salt = crypt(microtime() . mt_rand(0, mt_getrandmax()));
$cipher = new \Crypt_AES(CRYPT_AES_MODE_ECB);
$cipher->setPassword($key, 'pbkdf2', 'sha256', $salt, 1000);
$payload_enc = $cipher->encrypt($payload);
$message = base64_encode(serialize(array('s' => $salt, 'p' => $payload_enc, 't' => @gmmktime())));
return $message;
}
开发者ID:SkyFire-Lee,项目名称:x7chat,代码行数:11,代码来源:api.php
示例9: decrypt
public static function decrypt($secret, $password, ApiKeyEncryptionOptions $options)
{
$decodedSecret = self::base64url_decode($secret);
$salt = self::base64url_decode($options->getEncryptionKeySalt());
$iterations = $options->getEncryptionKeyIterations();
$keyLengthBits = $options->getEncryptionKeySize();
$iv = substr($decodedSecret, 0, 16);
$aes = new \Crypt_AES();
$aes->setPassword($password, 'pbkdf2', 'sha1', $salt, $iterations, $keyLengthBits / 8);
$aes->setKeyLength($keyLengthBits);
$aes->setIV($iv);
return $aes->decrypt(substr($decodedSecret, 16));
}
开发者ID:InfinityCCS,项目名称:stormpath-sdk-php,代码行数:13,代码来源:ApiKeyEncryptionUtils.php
示例10: loginWSAuthenticate
/**
* Checks whether a user has the right to enter on the platform or not
* @param string The username, as provided in form
* @param string The cleartext password, as provided in form
* @param string The WS URL, as provided at the beginning of this script
*/
function loginWSAuthenticate($username, $password, $wsUrl)
{
// check params
if (empty($username) or empty($password) or empty($wsUrl)) {
return false;
}
// Create new SOAP client instance
$client = new SoapClient($wsUrl);
if (!$client) {
return false;
}
// Include phpseclib methods, because of a bug with AES/CFB in mcrypt
include_once api_get_path(LIBRARY_PATH) . 'phpseclib/Crypt/AES.php';
// Define all elements necessary to the encryption
$key = '-+*%$({[]})$%*+-';
// Complete password con PKCS7-specific padding
$blockSize = 16;
$padding = $blockSize - strlen($password) % $blockSize;
$password .= str_repeat(chr($padding), $padding);
$cipher = new Crypt_AES(CRYPT_AES_MODE_CFB);
$cipher->setKeyLength(128);
$cipher->setKey($key);
$cipher->setIV($key);
$cipheredPass = $cipher->encrypt($password);
// Mcrypt call left for documentation purposes - broken, see https://bugs.php.net/bug.php?id=51146
//$cipheredPass = mcrypt_encrypt(MCRYPT_RIJNDAEL_128, $key, $password, MCRYPT_MODE_CFB, $key);
// Following lines present for debug purposes only
/*
$arr = preg_split('//', $cipheredPass, -1, PREG_SPLIT_NO_EMPTY);
foreach ($arr as $char) {
error_log(ord($char));
}
*/
// Change to base64 to avoid communication alteration
$passCrypted = base64_encode($cipheredPass);
// The call to the webservice will change depending on your definition
try {
$response = $client->validateUser(array('user' => $username, 'pass' => $passCrypted, 'system' => 'chamilo'));
} catch (SoapFault $fault) {
error_log('Caught something');
if ($fault->faultstring != 'Could not connect to host') {
error_log('Not a connection problem');
throw $fault;
} else {
error_log('Could not connect to WS host');
}
return 0;
}
return $response->validateUserResult;
}
开发者ID:KRCM13,项目名称:chamilo-lms,代码行数:56,代码来源:login.ws.php
示例11: fileRead
function fileRead($key)
{
$file = fopen("data.php", "r");
$aes = new Crypt_AES();
$aes->setKey($key);
$tempdata = "";
if ($file) {
$tempdata = file_get_contents("data.php");
$tempdata = substr($tempdata, strlen($GLOBALS["fileStart"]));
$tempdata = $aes->decrypt(substr($tempdata, 0, -strlen($GLOBALS["fileEnd"])));
}
fclose($file);
return $tempdata;
}
开发者ID:abcdlzy,项目名称:webshell-manager,代码行数:14,代码来源:DataOperator.php
示例12: initAes
protected function initAes($key, $iv, $keySize)
{
$this->aes = new \Crypt_AES();
$this->aes->setKeyLength($keySize);
$this->aesKey = $key;
$this->aesIV = $iv;
$this->aes->setKey($this->aesKey);
$this->aes->setIV($this->aesIV);
}
开发者ID:amegatron,项目名称:cryptoapi,代码行数:9,代码来源:CryptoApiHelper.php
示例13: pac_message_receiver
public function pac_message_receiver()
{
$content = Req::post("content");
if (!isset($content)) {
$this->returnXML("false", "S09", "返回报文为空");
}
$signature = Req::post("data_digest");
if (!isset($signature)) {
$this->returnXML("false", "S09", "返回报文为空");
}
Tiny::log("异步审批结果回执信息【content:" . $content . "】data_digest【" . $signature . "】");
// 测试密钥
$aeskey = base64_decode($this->jkf['aes_key']);
//AES解密,采用ECB模式
$aes = new Crypt_AES(CRYPT_MODE_ECB);
//设置AES密钥
$aes->setKey($aeskey);
//解密AES密文
$plaintext = $aes->decrypt(base64_decode($content));
//测试rsa公钥
$publickey = $this->jkf['public_key'];
$rsa = new Crypt_RSA();
//设置RSA签名模式 CRYPT_RSA_SIGNATURE_PSS or CRYPT_RSA_SIGNATURE_PKCS1
$rsa->setSignatureMode(CRYPT_RSA_SIGNATURE_PKCS1);
//使用RSA公钥验证签名
$rsa->loadKey(base64_decode($publickey));
//签名通过
if ($rsa->verify($plaintext, base64_decode($signature))) {
$contentXML = simplexml_load_string($plaintext);
$businessType = (string) $contentXML->head->businessType;
$model = new GatewayModel();
if ($businessType == "RESULT") {
$model->insertResult($contentXML, "1");
} else {
if ($businessType == "PRODUCT_RECORD") {
$model->insertExamineResult($contentXML);
}
}
$this->returnXML();
} else {
$this->returnXML("false", "S02", "非法的数字签名");
}
}
开发者ID:sammychan1981,项目名称:quanpin,代码行数:43,代码来源:gateway.php
示例14: attendance
function attendance()
{
require_once 'AES.php';
$aes = new Crypt_AES();
$aes->setKey($this->site->conf['AESKey']);
switch ($_GET['page'] ? $_GET['page'] : 00) {
case 00:
if ($this->site->userPermit == '3') {
$auth = base64_encode($aes->encrypt($_COOKIE['email'] . ' ' . $_COOKIE['pass']));
setcookie('email', $_POST['email'], 0, '/');
setcookie('pass', md5($_POST['password']), 0, '/');
$team = $this->mysql->get_rows('SELECT * FROM `team` WHERE `active` = YEAR(CURDATE()) ORDER BY `name` ASC ');
foreach ($team as $key => $i) {
$list[] = array('<% ID %>' => $i['id'], '<% NAME %>' => $i['name']);
}
$ret = $this->templates->process_between('attendance.html', '<% STUDENTS %>', $list);
$ret = $this->templates->process($ret, array('<% AUTH %>' => $auth));
echo $this->templates->template('Team Attendance', array(), $ret);
} else {
$this->site->home_page();
}
break;
case 01:
list($email, $pass) = explode(' ', $aes->decrypt(base64_decode($_POST['auth'])));
if ($this->site->checkCredentials($email, $pass) && $this->site->userPermit == '3') {
die("1");
} else {
die("0");
}
break;
case 02:
$pass = $this->mysql->get_row('SELECT `password` FROM `team` WHERE `id` = ' . $_POST['id'] . ' LIMIT 1');
if ($pass['password'] == md5($_POST['pass'])) {
$this->mysql->query("INSERT INTO `attendence` (`id`, `date`, `teamid`) VALUES (NULL, CURDATE(), '" . $_POST['id'] . "')");
die("1");
}
break;
}
}
开发者ID:ksiegel,项目名称:FRC-CMS,代码行数:39,代码来源:team.php
示例15: decrypt_data
public function decrypt_data($input_str, $key = SEC_STR)
{
$aes = new Crypt_AES();
$aes->setKey($key);
return $aes->decrypt($input_str);
}
开发者ID:demenvil,项目名称:BitScrow,代码行数:6,代码来源:bit-sci.lib.php
示例16: _parseKey
/**
* Break a public or private key down into its constituant components
*
* @access private
* @see _convertPublicKey()
* @see _convertPrivateKey()
* @param String $key
* @param Integer $type
* @return Array
*/
function _parseKey($key, $type)
{
if ($type != CRYPT_RSA_PUBLIC_FORMAT_RAW && !is_string($key)) {
return false;
}
switch ($type) {
case CRYPT_RSA_PUBLIC_FORMAT_RAW:
if (!is_array($key)) {
return false;
}
$components = array();
switch (true) {
case isset($key['e']):
$components['publicExponent'] = $key['e']->copy();
break;
case isset($key['exponent']):
$components['publicExponent'] = $key['exponent']->copy();
break;
case isset($key['publicExponent']):
$components['publicExponent'] = $key['publicExponent']->copy();
break;
case isset($key[0]):
$components['publicExponent'] = $key[0]->copy();
}
switch (true) {
case isset($key['n']):
$components['modulus'] = $key['n']->copy();
break;
case isset($key['modulo']):
$components['modulus'] = $key['modulo']->copy();
break;
case isset($key['modulus']):
$components['modulus'] = $key['modulus']->copy();
break;
case isset($key[1]):
$components['modulus'] = $key[1]->copy();
}
return isset($components['modulus']) && isset($components['publicExponent']) ? $components : false;
case CRYPT_RSA_PRIVATE_FORMAT_PKCS1:
case CRYPT_RSA_PUBLIC_FORMAT_PKCS1:
/* Although PKCS#1 proposes a format that public and private keys can use, encrypting them is
"outside the scope" of PKCS#1. PKCS#1 then refers you to PKCS#12 and PKCS#15 if you're wanting to
protect private keys, however, that's not what OpenSSL* does. OpenSSL protects private keys by adding
two new "fields" to the key - DEK-Info and Proc-Type. These fields are discussed here:
http://tools.ietf.org/html/rfc1421#section-4.6.1.1
http://tools.ietf.org/html/rfc1421#section-4.6.1.3
DES-EDE3-CBC as an algorithm, however, is not discussed anywhere, near as I can tell.
DES-CBC and DES-EDE are discussed in RFC1423, however, DES-EDE3-CBC isn't, nor is its key derivation
function. As is, the definitive authority on this encoding scheme isn't the IETF but rather OpenSSL's
own implementation. ie. the implementation *is* the standard and any bugs that may exist in that
implementation are part of the standard, as well.
* OpenSSL is the de facto standard. It's utilized by OpenSSH and other projects */
if (preg_match('#DEK-Info: (.+),(.+)#', $key, $matches)) {
$iv = pack('H*', trim($matches[2]));
$symkey = pack('H*', md5($this->password . substr($iv, 0, 8)));
// symkey is short for symmetric key
$symkey .= substr(pack('H*', md5($symkey . $this->password . $iv)), 0, 8);
$ciphertext = preg_replace('#.+(\\r|\\n|\\r\\n)\\1|[\\r\\n]|-.+-| #s', '', $key);
$ciphertext = preg_match('#^[a-zA-Z\\d/+]*={0,2}$#', $ciphertext) ? base64_decode($ciphertext) : false;
if ($ciphertext === false) {
$ciphertext = $key;
}
switch ($matches[1]) {
case 'AES-128-CBC':
if (!class_exists('Crypt_AES')) {
require_once 'Crypt/AES.php';
}
$symkey = substr($symkey, 0, 16);
$crypto = new Crypt_AES();
break;
case 'DES-EDE3-CFB':
if (!class_exists('Crypt_TripleDES')) {
require_once 'Crypt/TripleDES.php';
}
$crypto = new Crypt_TripleDES(CRYPT_DES_MODE_CFB);
break;
case 'DES-EDE3-CBC':
if (!class_exists('Crypt_TripleDES')) {
require_once 'Crypt/TripleDES.php';
}
$crypto = new Crypt_TripleDES();
break;
case 'DES-CBC':
if (!class_exists('Crypt_DES')) {
require_once 'Crypt/DES.php';
}
$crypto = new Crypt_DES();
//.........这里部分代码省略.........
开发者ID:macconsultinggroup,项目名称:WordPress,代码行数:101,代码来源:RSA.php
示例17: exit
exit('Error: BoxID error.');
}
###
$return = 'boxgamefile.php?id=' . urlencode($boxid);
require "../configuration.php";
require "./include.php";
require_once "../includes/func.ssh2.inc.php";
require_once "../libs/phpseclib/Crypt/AES.php";
require_once "../libs/gameinstaller/gameinstaller.php";
$title = T_('Box Game File Repositories');
if (query_numrows("SELECT `name` FROM `" . DBPREFIX . "box` WHERE `boxid` = '" . $boxid . "'") == 0) {
exit('Error: BoxID is invalid.');
}
$rows = query_fetch_assoc("SELECT * FROM `" . DBPREFIX . "box` WHERE `boxid` = '" . $boxid . "' LIMIT 1");
$games = mysql_query("SELECT * FROM `" . DBPREFIX . "game` ORDER BY `game`");
$aes = new Crypt_AES();
$aes->setKeyLength(256);
$aes->setKey(CRYPT_KEY);
// Get SSH2 Object OR ERROR String
$ssh = newNetSSH2($rows['ip'], $rows['sshport'], $rows['login'], $aes->decrypt($rows['password']));
if (!is_object($ssh)) {
$_SESSION['msg1'] = T_('Connection Error!');
$_SESSION['msg2'] = $ssh;
$_SESSION['msg-type'] = 'error';
}
$gameInstaller = new GameInstaller($ssh);
include "./bootstrap/header.php";
/**
* Notifications
*/
include "./bootstrap/notifications.php";
开发者ID:404rq,项目名称:bgpanel,代码行数:31,代码来源:boxgamefile.php
示例18: getPassword
function getPassword($pwd = null, $iv_field = "iv")
{
if (is_null($pwd)) {
$pwd = $this->password;
if (!$this->password) {
return "";
}
}
try {
$master_key_filepath = CAppUI::conf("master_key_filepath");
$master_key_filepath = rtrim($master_key_filepath, "/");
if (CExchangeSource::checkMasterKeyFile($master_key_filepath)) {
CAppUI::requireLibraryFile("phpseclib/phpseclib/Crypt/AES");
CAppUI::requireLibraryFile("phpseclib/phpseclib/Crypt/Random");
$cipher = new Crypt_AES(CRYPT_AES_MODE_CTR);
$cipher->setKeyLength(256);
$keyAB = file($master_key_filepath . "/.mediboard.key");
if (count($keyAB) == 2) {
$cipher->setKey($keyAB[0] . $keyAB[1]);
$ivToUse = $this->{$iv_field};
if (!$ivToUse) {
$clear = $pwd;
$this->store();
return $clear;
}
$cipher->setIV($ivToUse);
$decrypted = rtrim(base64_decode($pwd), "");
$decrypted = $cipher->decrypt($decrypted);
if ($decrypted) {
return $decrypted;
}
}
}
} catch (Exception $e) {
return $pwd;
}
return $pwd;
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:38,代码来源:CExchangeSource.class.php
示例19: MySQLidb
require_once ABSPATH . 'db_config.php';
require_once ABSPATH . 'includes/autoload.php';
require_once ABSPATH . 'includes/errors.php';
$db = new MySQLidb(DB_HOST, DB_USER, DB_PASSWORD, DB_NAME, DB_PORT);
$encrypted_data = $_REQUEST['data'];
//debug_print("encrypted_data={$encrypted_data}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
$binary_tx_hashes = decrypt_data($encrypted_data, $db, $decrypted_key);
if (substr($binary_tx_hashes, 0, 7) == '[error]') {
die($binary_tx_hashes);
}
//debug_print("binary_tx_hashes={$binary_tx_hashes}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
$binary_tx = '';
// Разбираем список транзакций
do {
list(, $tx_hash) = unpack("H*", string_shift($binary_tx_hashes, 16));
if (!$tx_hash) {
continue;
}
$tx = $db->query(__FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__, "\n\t\t\tSELECT `data`\n\t\t\tFROM `" . DB_PREFIX . "transactions`\n\t\t\tWHERE `hash` = 0x{$tx_hash}\n\t\t\t", 'fetch_one');
if ($tx) {
$binary_tx .= ParseData::encode_length_plus_data($tx);
}
} while ($binary_tx_hashes);
// шифруем тр-ии
$aes = new Crypt_AES();
$aes->setKey($decrypted_key);
$encrypted_data = $aes->encrypt($binary_tx);
unset($aes);
//debug_print("decrypted_key={$decrypted_key}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
//debug_print("encrypted_data={$encrypted_data}", __FILE__, __LINE__, __FUNCTION__, __CLASS__, __METHOD__);
print $encrypted_data;
开发者ID:scuba323,项目名称:dcoin,代码行数:31,代码来源:get_tx.php
示例20: launchkey_plugin_init
/**
* Initialize LaunchKey WordPress Plugin
*
* This function will perform the entire initializaiton for the plugin. The initialization is encapsulated into
* a funciton to protect against global variable collision.
*
* @since 1.0.0
* Enclose plug-in initialization to protect against global variable corruption
*/
function launchkey_plugin_init()
{
/**
* Language domain for the plugin
*/
$language_domain = 'launchkey';
/**
* Register plugin text domain with language files
*
* @see load_plugin_textdomain
* @link https://developer.wordpress.org/reference/hooks/plugins_loaded/
*/
add_action('plugins_loaded', function () use($language_domain) {
load_plugin_textdomain($language_domain, false, plugin_basename(__FILE__) . '/languages/');
});
/**
* Get the WP global facade
* @see LaunchKey_WP_Global_Facade
*/
$facade = new LaunchKey_WP_Global_Facade();
/**
* Create an AES encryption class for encryption/decryption of the secret options
* @link https://docs.launchkey.com/glossary.html#term-aes
*/
$crypt_aes = new Crypt_AES();
/**
* Use an MD5 hash of the auth key as the crypto key. The crypto key is used as it would normally affect all auth
* procedures as it is used as a salt for passwords. An md5 hash is used as it will be a constant value based on
* the AUTH_KEY but guaranteed to be exactly thirty-two (32) characters as is needed by AES encryption.
*/
$crypt_aes->setKey(md5(AUTH_KEY));
// Create an options handler that will encrypt and decrypt the plugin options as necessary
$options_handler = new LaunchKey_WP_Options($crypt_aes);
/**
* The pre_update_option_launchkey filter will process the "launchkey" option directly
* before updating the data in the database.
*
* @since 1.0.0
* @link https://developer.wordpress.org/reference/hooks/pre_update_option_option/
* @see LaunchKey_WP_Options::pre_update_option_filter
*/
add_filter('pre_update_option_launchkey', array($options_handler, 'pre_update_option_filter'));
/**
* The pre_update_option_filter filter will process the "launchkey" option directly
* before adding the data in the database.
*
* @since 1.0.0
* @link https://developer.wordpress.org/reference/hooks/pre_update_option_option/
* @see LaunchKey_WP_Options::pre_update_option_filter
*/
add_filter('pre_add_option_launchkey', array($options_handler, 'pre_update_option_filter'));
/**
* The option_launchkey filter will process the "launchkey" option directly
* after retrieving the data from the database.
*
* @since 1.0.0
* @link https://developer.wordpress.org/reference/hooks/option_option/
* @see LaunchKey_WP_Options::post_get_option_filter
*/
add_filter('option_launchkey', array($options_handler, 'post_get_option_filter'));
/**
* If the pre-1.0.0 option style was already used, create a 1.0.0 option and remove the old options. They are
* removed as the secret_key was stored plain text in the database.
*
* @since 1.0.0
*/
if (get_option('launchkey_app_key') || get_option('launchkey_secret_key')) {
$launchkey_options[LaunchKey_WP_Options::OPTION_ROCKET_KEY] = get_option('launchkey_app_key');
$launchkey_options[LaunchKey_WP_Options::OPTION_SECRET_KEY] = get_option('launchkey_secret_key');
$launchkey_options[LaunchKey_WP_Options::OPTION_SSL_VERIFY] = defined('LAUNCHKEY_SSLVERIFY') && LAUNCHKEY_SSLVERIFY || true;
$launchkey_options[LaunchKey_WP_Options::OPTION_IMPLEMENTATION_TYPE] = LaunchKey_WP_Implementation_Type::OAUTH;
$launchkey_options[LaunchKey_WP_Options::OPTION_LEGACY_OAUTH] = true;
if (update_option(LaunchKey_WP_Admin::OPTION_KEY, $launchkey_options)) {
delete_option('launchkey_app_key');
delete_option('launchkey_secret_key');
} else {
throw new RuntimeException('Unable to upgrade LaunchKey meta-data. Failed to save setting ' . LaunchKey_WP_Admin::OPTION_KEY);
}
} elseif (!get_option(LaunchKey_WP_Admin::OPTION_KEY)) {
add_option(LaunchKey_WP_Admin::OPTION_KEY, array());
}
/**
* Create a templating object and point it at the correct directory for template files.
*
* @see LaunchKey_WP_Template
*/
$template = new LaunchKey_WP_Template(__DIR__ . '/templates', $facade, $language_domain);
// Prevent XXE Processing Vulnerability
libxml_disable_entity_loader(true);
// Get the plugin options to determine which authentication implementation should be utilized
$options = get_option(LaunchKey_WP_Admin::OPTION_KEY);
//.........这里部分代码省略.........
开发者ID:ThemeSurgeon,项目名称:launchkey-wordpress,代码行数:101,代码来源:launchkey.php
注:本文中的Crypt_AES类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论