洛阳学员端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

234 lines
9.8 KiB

8 months ago
  1. //
  2. // ASSCommon.h
  3. // ae-security-sdk
  4. //
  5. // Created by xingchen on 14/12/30.
  6. // Copyright (c) 2014年 Alipay. All rights reserved.
  7. //
  8. #import <Foundation/Foundation.h>
  9. #import "ASSLogger.h"
  10. //#define IN_DEBUG
  11. #define USED_BY_ALIPAY
  12. static NSErrorDomain APSECURITYSDK_ERROR_DOMAIN = @"APSecuritySDKErrorDomain";
  13. static NSString* const PRIVATE_KEY_XXXX = @"qqAIhzy)H)ip53<>ugx,sI{#}CE$37L|z5G=IScgO^=aQHaN[b|NM.RWdZpcy.r$";
  14. static NSString* const PRIVATE_KEY_CLIENTKEY = @"EQopzyui)H)ipQW983<ll>uitx,sgI{#}##20110kl==^^woQG,msq.xinjun.$$";
  15. static NSString* const LOG_SWITCH_SETTING_INITIALIZED = @"开关设置从keychain初始化成功";
  16. static NSString* const LOG_LOAD_SETTING_EXCEPTION = @"开关设置在keychain中无存储,读取失败";
  17. static NSString* const LOG_DECRYPT_SETTING_EXCEPTION = @"开关设置从keychain中读取成功,解密失败";
  18. static NSString* const LOG_SWITCH_APPLIST_INITIALIZED = @"applist从keychain初始化成功";
  19. static NSString* const LOG_LOAD_APPLIST_EXCEPTION = @"applist相关信息在keychain中无存储,读取失败";
  20. static NSString* const LOG_DECRYPT_APPLIST_EXCEPTION = @"applist信息从keychain中读取成功,解密失败";
  21. static NSString* const LOG_UMID_TOKEN_REQUEST_BACK = @"UMID TOKEN返回结果为:";
  22. static NSString* const LOG_VKEYINFO_GENERATED = @"本地VKEY开关打开,将生成VKEY信息";
  23. static NSString* const LOG_VKEYINFO_ABORT = @"本地VKEY开关关闭,将放弃生成VKEY信息";
  24. static NSString* const LOG_VKEY_NO_KEYCHAIN_CACHE = @"VKEY缓存信息在keychain中无存储,读取失败";
  25. static NSString* const LOG_VKEY_FOUND_KEYCHAIN_CACHE = @"VKEY缓存信息在keychain中获取缓存值";
  26. static NSString* const LOG_VKEY_INFO_DETAIL = @"KEY信息为:";
  27. static NSString* const LOG_VKEY_GENERATION_EXCEPTION = @"VEr:";
  28. static NSString* const LOG_GID_GENERATED = @"本地GID开关打开,将生成GID信息";
  29. static NSString* const LOG_GID_ABORT = @"本地GID开关关闭,将放弃生成GID信息";
  30. static NSString* const LOG_GID_NO_KEYCHAIN_CACHE = @"GID缓存信息在keychain中无存储,读取失败";
  31. static NSString* const LOG_GID_FOUND_KEYCHAIN_CACHE = @"GID缓存信息在keychain中获取缓存值";
  32. static NSString* const LOG_GID_INFO_DETAIL = @"GID信息为:";
  33. static NSString* const LOG_VOS_RUNNING = @"VKEY任务启动";
  34. static NSString* const LOG_VOS_ASYNC_ABORT = @"放弃异步VOS任务";
  35. static NSString* const LOG_VOS_VKEY_GENERATION = @"VOS VKEY采集中";
  36. static NSString* const LOG_VOS_GID_GENERATION = @"VOS GID采集中";
  37. static NSString* const LOG_GID_GENERATION_EXCEPTION = @"GEr:";
  38. static NSString* const LOG_JB_ERROR_DETECTED = @"JEr";
  39. static NSString* const LOG_STATIC_INFO_DETAIL = @"采集静态信息列表如下:";
  40. static NSString* const LOG_APP_LIST_INFO_COLLECTED = @"APPLIST信息扫描获取中";
  41. static NSString* const LOG_APP_LIST_INFO_ABORT = @"APPLIST信息放弃扫描获取";
  42. static NSString* const LOG_LOAD_MODEL_KEYCHAIN_EXCEPTION = @"VKEYID在keychain无存储,读取失败";
  43. static NSString* const LOG_LOAD_MODEL_FROM_KEYCHAIN = @"VKEYID从keychain中成功读取";
  44. static NSString *const LOG_LOCALMODEL_ABSENT = @"本地未找到VKEYID存储";
  45. static NSString *const LOG_LOCALMODEL_LOADSUCCESS = @"本地成功找到VKEYID存储";
  46. static NSString *const LOG_LOAD_PREAPDID_SUCCESS = @"本地成功在keychain中读取旧版apdid的值:";
  47. static NSString *const LOG_LOAD_PREAPDID_FAILED = @"旧版apdid在keychain中无存储,读取失败";
  48. static NSString* const LOG_STATIC_INFO_CHANGED = @"所采集的静态信息发生改变或者存储中没有记录";
  49. static NSString* const LOG_STATIC_INFO_SAME = @"所采集的静态信息与存储中相同";
  50. static NSString* const LOG_TODAY_FIRST = @"检测为24小时内首次请求";
  51. static NSString* const LOG_NOT_TODAY_FIRST = @"检测24小时内已经发起过请求";
  52. static NSString *const LOG_GETAPDIDTOKEN_RET_LOCAL = @"不发起网络请求,直接返回本地存储";
  53. static NSString* const LOG_CONNECT_TO_SERVER = @"需要访问服务器请求TOKEN";
  54. static NSString* const LOG_REQUEST_INFO_INCLUDED = @"静态请求上传需要携带静态信息";
  55. static NSString* const LOG_REQUEST_INFO_EXCLUDED = @"静态请求上传不需要携带静态信息";
  56. static NSString* const LOG_STATIC_REQUEST_EXCEPTION = @"静态数据请求发送出现异常";
  57. static NSString* const LOG_STATIC_REQUEST_FAILED = @"静态数据请求返回出现错误";
  58. static NSString* const LOG_STATIC_REQUEST_SUCCESS = @"静态数据请求请求返回";
  59. static NSString* const LOG_SERVER_RESPONSE_SUCCESS = @"服务端返回结果通过验证,证明有效:";
  60. static NSString* const LOG_SERVER_RESPONSE_FAILED = @"服务端获取TOKEN失败";
  61. static NSString* const LOG_LOG_REQUEST_RESPONSE = @"日志上传成功返回";
  62. static NSString *const LOG_LOCALMODEL_SAVED_KEYCHAIN = @"成功将VKEY ID保存至keychain";
  63. static NSString *const LOG_UPDATE_SETTING = @"已更新keychain中开关的设置值";
  64. static NSString* const LOG_APP_LIST_NEED_UPDATE = @"经过检测,app list列表需要从服务器更新";
  65. static NSString *const LOG_UPDATE_APPLIST = @"app list列表成功从服务器更新";
  66. static NSString* const LOG_APPLIST_SETTING_SAVED_KEYCHAIN = @"app list列表信息成功更新至keychain保存";
  67. static NSString* const LOG_APP_LIST_REQUEST_EXCEPTION = @"app list请求出现异常";
  68. static NSString* const LOG_APP_LIST_RESPONSE_FAILED = @"app list请求结果失败";
  69. static NSString* const LOG_LOG_UPDATE_EXCEPTION = @"日志信息请求发送出现异常";
  70. static NSString* const LOG_LOG_UPLOAD_ERROR = @"日志信息发送出现错误";
  71. static NSString* const LOG_LOG_UPLOAD_SUCCESS = @"日志信息发送返回成功";
  72. static NSString *const LOG_SETTINGMODEL_SAVEFAILED = @"开关信息保存错误";
  73. static NSString *const LOG_SETTINGMODEL_SUCCESS = @"开关信息成功保存到keychain";
  74. static NSString* const LOG_LOG_UPLOAD_PROCESS = @"上报日志开关打开,开始上报错误日志流程";
  75. static NSString* const LOG_LOG_UPLOAD_ABORT = @"上报日志开关关闭,放弃上报错误日志";
  76. static NSString* const LOG_LOG_FILE_DETAIL = @"检测到错误日志文件:";
  77. static NSString* const LOG_LOG_FILE_REMOVAL = @"已经删除错误日志文件:";
  78. static NSString* const LOG_LOG_UPLOAD_START = @"开始日志上报网络请求";
  79. static NSString* const LOG_LOG_UPLOAD_DETAIL = @"日志上报网络请求具体内容:";
  80. static NSString* const LOG_JSON_PARSE_EXCEPTION = @"JSON解析失败";
  81. static NSString* const ASS_STORAGE_KEY_SUCCESS = @"success";
  82. static NSString* const ASS_STORAGE_KEY_APDID = @"apdid";
  83. static NSString* const ASS_STORAGE_KEY_TOKEN = @"token";
  84. static NSString* const ASS_STORAGE_KEY_TIME = @"time";
  85. static NSString* const ASS_STORAGE_KEY_VKEYSWITCH = @"vkeyon";
  86. static NSString* const ASS_STORAGE_KEY_LOGSWITCH = @"logon";
  87. static NSString* const ASS_STORAGE_KEY_APPLISTVERSION = @"appver";
  88. static NSString* const ASS_STORAGE_KEY_STATICHASH = @"statichash";
  89. static NSString* const ASS_STORAGE_KEY_ERROR = @"error";
  90. static NSString* const ASS_APPKEY_INVALID = @"APPKEY_ERROR";
  91. static NSString* const ASS_STORAGE_KEY_WEBRTCURL = @"webrtcurl";
  92. static NSString* const ASS_STORAGE_KEY_DYNAMICKEY = @"dynamickey";
  93. static NSString* const ASS_STORAGE_KEY_AGENTURL = @"agentcurl";
  94. static NSString* const ASS_STORAGE_KEY_APSE_DEGRADE = @"apse_degrade";
  95. static NSString* const ASS_STORAGE_KEY_TIMEINTERVAL = @"timeInterval";
  96. static NSString* const SECURE_SDK_KEYCHAIN_KEY = @"com.alipay.securesdk.storage";
  97. static NSString* const LAST_LOGIN_TIME_KEY = @"com.alipay.asssecuritySDK.lastlogintime";
  98. static NSString* const SECURE_SDK_RANDOM_STRING = @"com.alipay.securesdk.ranstr";
  99. static NSString* const SECURE_SDK_RANDOM_TOKEN = @"com.alipay.securesdk.tokenid";
  100. static NSString* const ASS_KEYCHAIN_KEY_SETTING = @"com.alipay.asssecuresdk.config";
  101. static NSString* const SECURE_SDK_RANDOM_CLIENTKEY_STRING = @"com.alipay.securesdk.clientkey";
  102. static NSString* const SECURE_SDK_KEYCHAIN_TOKEN = @"maintoken";
  103. static NSString* const ASS_KEYCHAIN_KEY_APPLIST = @"com.alipay.asssecuresdk.list";
  104. static NSString* const ASS_KEYCHAIN_KEY_DFP = @"com.alipay.asssecuresdk.dfp";
  105. static NSString* const ASS_KEYCHAIN_KEY_GID = @"com.alipay.asssecuresdk.gid";
  106. static NSString* const ASS_KEYCHAIN_KEY_JBER = @"com.alipay.asssecuresdk.jber";
  107. static NSString* const ASS_KEYCHAIN_KEY_APDIDC = @"com.alipay.asssecuresdk.apdidc";
  108. static NSString* const ASS_KEYCHAIN_KEY_TMXTIME = @"com.alipay.asssecuresdk.tmxtime";
  109. static NSString* const ASS_KEYCHAIN_KEY_TMXSESSOINID = @"com.alipay.asssecuresdk.tmxsessionid";
  110. static NSString* const ASS_KEYCHAIN_KEY_ARPMAC = @"com.alipay.asssecuresdk.arpmac";
  111. static NSString* const ASS_KEYCHAIN_KEY_DYNAMICKEY = @"com.alipay.asssecuresdk.dynamickey";
  112. static NSString* const ASS_USER_DEFAULT_KEY_DEGRADE_TIME = @"asssecuritysdkdegrade";
  113. static const int overtime = 9;
  114. //CRASHGUARD
  115. static NSString* const CRASH_GUARD_GET_COLOR_INFO = @"05f445";
  116. static NSString* const CRASH_GUARD_PRE_COLOR_INFO = @"f379d2";
  117. static NSString* const CRASH_GUARD_INIT_COLOR_INFO = @"25f523";
  118. static NSString* const CRASH_GUARD_UPDATE_COLOR_CODE = @"8e81ac";
  119. static NSString* const CRASH_GUARD_GET_COLOR_LABEL = @"d785d8";
  120. static NSString* const CRASH_GUARD_UPDATE_COLOR_LABEL = @"dccf1d";
  121. static NSString* const CRASH_GUARD_INIT_TOKEN = @"0780aa";
  122. static NSString* const CRASH_GUARD_INIT = @"e37f013";
  123. @interface ASSCommon : NSObject
  124. + (int)getCurrentMode;
  125. + (NSString*)getRPCURL;
  126. + (NSString*)getServerHost;
  127. + (void) setRPCHeader:(NSDictionary*)header;
  128. + (NSDictionary*)getRPCHeader;
  129. + (void)setupEnvironmentMode:(int)mode;
  130. + (void)setupRPCAddress:(NSString*)address;
  131. + (BOOL)useURLWhitelist;
  132. + (BOOL)checkDeviceSystemVersion;
  133. + (void)setSecuritySDKConfig:(int)address;
  134. + (void)setRpcHeaderAppid:(NSString*)apid;
  135. + (NSString*)getRpcHeaderAppid;
  136. + (void)setRpcHeaderWorkspaceid:(NSString*)spaceid;
  137. + (NSString*)getRpcHeaderWorkspaceid;
  138. @end