예제 #1
0
 public function verifying($data)
 {
     if (!is_array($data) || count($data) < 7) {
         return false;
     }
     $keysService = $this->getKeysService();
     $key6 = $keysService->getKey6(2);
     require_once Wind::getRealPath("ACLOUD:system.core.ACloudSysCoreVerify");
     if ($key6 && strlen($key6) == 128 && ACloudSysCoreVerify::verifyWithOAuth($data, $key6)) {
         return true;
     }
     return false;
 }
 public function apiControl($data)
 {
     $appsService = ACloudSysCoreCommon::loadSystemClass('apps', 'config.service');
     if (!$data || !is_array($data) || !isset($data['app_id']) || !$data['app_id']) {
         return false;
     }
     $app = $appsService->getApp($data['app_id']);
     if (!$app || strlen($app['app_token']) != 128) {
         return false;
     }
     require_once Wind::getRealPath("ACLOUD:system.core.ACloudSysCoreVerify");
     if (ACloudSysCoreVerify::verifyWithOAuth($data, $app['app_token'])) {
         return true;
     }
     return false;
 }
 public function checkSecretKey($data)
 {
     if (!ACloudSysCoreS::isArray($data) || !isset($data['plaintext']) || !$data['plaintext'] || !isset($data['ciphertext']) || !$data['ciphertext']) {
         return array(false, 'apply_checkkey_invalid_params');
     }
     $keysService = ACloudSysCoreCommon::loadSystemClass('keys', 'config.service');
     $key6 = $keysService->getKey6(2);
     if (!$key6 || strlen($key6) != 128) {
         return array(false, 'apply_checkkey_invalid_key6');
     }
     unset($data['a']);
     unset($data['m']);
     unset($data['c']);
     if (!ACloudSysCoreVerify::verifyWithOAuth($data, $key6)) {
         return array(false, 'apply_checkkey_wrong_sign');
     }
     if (!ACloudSysCoreVerify::verifyWithAES($data['ciphertext'], $data['plaintext'])) {
         return array(false, 'apply_checkkey_fail');
     }
     return array(true, 'apply_checkkey_success');
 }
 public function getLink($data = array())
 {
     $params = $this->buildPostParams();
     require_once Wind::getRealPath("ACLOUD:system.core.ACloudSysCoreVerify");
     $params['accesssign'] = ACloudSysCoreVerify::createSignWithOAuth($params);
     require_once Wind::getRealPath("ACLOUD:system.core.ACloudSysCoreHttp");
     return sprintf("http://%s/index.php?%s", ACloudSysCoreDefine::ACLOUD_HOST_API, ACloudSysCoreHttp::httpBuildQuery(array_merge($params, $data)));
 }