Exemplo n.º 1
0
 function aseControl($data)
 {
     if (!is_array($data) || !isset($data['ciphertext']) || !$data['ciphertext']) {
         return false;
     }
     $keysService = ACloud_Sys_Core_Common::loadSystemClass('keys', 'config.service');
     $keys = $keysService->getKey123(1);
     if (!$keys || strlen($keys['key1']) != 128 || strlen($keys['key2']) != 128 || strlen($keys['key3']) != 128) {
         return false;
     }
     require_once ACLOUD_PATH . '/system/core/sys.core.aes.php';
     $aesService = new ACloud_Sys_Core_Aes();
     $key = $aesService->encrypt($keys['key3'], $keys['key2'], 256);
     if (!$key) {
         return false;
     }
     $plaintext = $aesService->strcode($data['ciphertext'], $key, 'DECODE');
     if (!$plaintext) {
         return false;
     }
     $params = ACloud_Sys_Core_Http::splitHttpQuery($plaintext);
     if (!is_array($params)) {
         return false;
     }
     $tmp = ACloud_Sys_Core_Common::arrayIntersectAssoc($params, $data);
     if (is_array($tmp) && count($tmp) > 0 && count($tmp) == count($params) && $tmp['securecode'] === $data['securecode']) {
         return true;
     }
     return false;
 }