$jsonStr = json_encode($cInfoArray, 1);
$cInfo = self::AESEncrypt($jsonStr, $aesKey);
openssl_public_encrypt($aesKey, $encrypted, file_get_contents(VISITOR_CARD_PUB_KEY));
openssl_public_decrypt(base64_decode($key), $decrypted, file_get_contents(VISITOR_CARD_PUB_KEY));
$aesParams = self::AESDecrypt($params, $decrypted);
private static function AESEncrypt($str, $key)
{
return openssl_encrypt($str, 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
}
private static function AESDecrypt($strEncode, $key)
{
return openssl_decrypt(base64_decode($strEncode), 'AES-128-ECB', $key, OPENSSL_RAW_DATA);
}