开发版本-developer——01 first commit
This commit is contained in:
+23
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// SecurityCipher.h
|
||||
// SecurityGuardSDK
|
||||
//
|
||||
// Created by lifengzhong on 15/1/19.
|
||||
// Copyright (c) 2015年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SecurityCipher : NSObject
|
||||
|
||||
+ (NSString*) encryptString: (NSString*) input key: (NSString*) key;
|
||||
|
||||
+ (NSString*) decryptString: (NSString*) input key: (NSString*) key;
|
||||
|
||||
+ (NSData*) encryptBinary: (NSData*) input key: (NSString*) key;
|
||||
|
||||
+ (NSData*) decryptBinary: (NSData*) input key: (NSString*) key;
|
||||
|
||||
+ (NSString*) atlasEncryptString: (NSString*) input ;
|
||||
|
||||
@end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// SecuritySignature.h
|
||||
// SecurityGuardSDK
|
||||
//
|
||||
// Created by lifengzhong on 15/1/19.
|
||||
// Copyright (c) 2015年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SecuritySignature : NSObject
|
||||
|
||||
+ (NSString*) sign: (NSString*) input key: (NSString*) key;
|
||||
|
||||
+ (NSString*) signWithSimulator: (NSString*) input key: (NSString*) key;
|
||||
|
||||
+ (NSString*) atlasSign: (NSString*) input key: (NSString*) key;
|
||||
|
||||
@end
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
//
|
||||
// SecurityStorage.h
|
||||
// SecurityGuardSDK
|
||||
//
|
||||
// Created by lifengzhong on 15/1/19.
|
||||
// Copyright (c) 2015年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SecurityStorage : NSObject
|
||||
|
||||
+ (NSInteger) putString: (NSString*) value key: (NSString*) key;
|
||||
|
||||
+ (NSString*) getString: (NSString*) key;
|
||||
|
||||
+ (void) removeString: (NSString*) key;
|
||||
|
||||
@end
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
//
|
||||
// SecurityVerification.h
|
||||
// SecurityGuardSDKPro
|
||||
//
|
||||
// Created by lifengzhong on 15/8/13.
|
||||
// Copyright (c) 2015年 alibaba. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SecurityVerification : NSObject
|
||||
|
||||
|
||||
/**
|
||||
* 聚安全防控接口
|
||||
*
|
||||
* @param info 其他需要的信息,以key-v形式存于info中,可选
|
||||
* @param timeout 接口调用超时时间,单位秒,最大不超过22,最小不小于1
|
||||
*
|
||||
* @return 聚安全服务器返回的安全token
|
||||
*/
|
||||
+ (NSString*) doJAQVerfificationSync: (NSDictionary*) info
|
||||
timeout: (NSInteger) timeout;
|
||||
|
||||
@end
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
//
|
||||
// SimulatorDetect.h
|
||||
// SecurityGuardSDKPro
|
||||
//
|
||||
// Created by yangzhao.zy on 15/8/21.
|
||||
// Copyright (c) 2015年 alibaba. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef SecurityGuardSDKPro_SimulatorDetect_h
|
||||
#define SecurityGuardSDKPro_SimulatorDetect_h
|
||||
|
||||
@interface SimulatorDetect : NSObject
|
||||
|
||||
+ (BOOL) isSimulator;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// IOpenSecurityGuardPlugin.h
|
||||
// SecurityGuardSDK
|
||||
//
|
||||
// Created by lifengzhong on 15/11/6.
|
||||
// Copyright © 2015年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
#ifndef IOpenSecurityGuardPlugin_h
|
||||
#define IOpenSecurityGuardPlugin_h
|
||||
|
||||
#define PLUGIN_META_INFO_NAME @"name"
|
||||
#define PLUGIN_META_INFO_VERSON @"version"
|
||||
#define PLUGIN_META_INFO_PLATFORM @"platform"
|
||||
#define PLUGIN_META_INFO_DEPENDENCY @"dependency"
|
||||
#define PLUGIN_META_INFO_DEPENDENCY_NAME @"dependency_name"
|
||||
#define PLUGIN_META_INFO_DEPENDENCY_MIN_VERSION @"dependency_min_version"
|
||||
#define PLUGIN_META_INFO_DEPENDENCY_OPTIONAL @"dependency_optional"
|
||||
#define PLUGIN_META_INFO_RESOURCE @"resource"
|
||||
#define PLUGIN_META_INFO_RESOURCE_NAME @"resource_name"
|
||||
#define PLUGIN_META_INFO_RESOURCE_MIN_VERSION @"resource_min_version"
|
||||
|
||||
|
||||
#define PLUGIN_META_INFO_PLATFORM_UNI @0
|
||||
#define PLUGIN_META_INFO_PLATFORM_EXT @1
|
||||
#define PLUGIN_META_INFO_PLATFORM_INT @2
|
||||
#define PLUGIN_META_INFO_DEPENDENCY_OPTIONAL_YES @1
|
||||
#define PLUGIN_META_INFO_DEPENDENCY_OPTIONAL_NO @0
|
||||
|
||||
@protocol IOpenSecurityGuardPlugin <NSObject>
|
||||
|
||||
+ (NSDictionary*) getMetaInfo;
|
||||
|
||||
+ (NSInteger) initializePlugin: (NSValue*) initParam;
|
||||
|
||||
+ (void*) pluginEntry;
|
||||
|
||||
@end
|
||||
|
||||
@protocol IOpenSecurityGuardPluginInterface <NSObject>
|
||||
|
||||
- (Class) getMetaClass;
|
||||
|
||||
@end
|
||||
|
||||
#endif /* IOpenSecurityGuardPlugin_h */
|
||||
+29
@@ -0,0 +1,29 @@
|
||||
//
|
||||
// SecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
/**
|
||||
* 增强加解密算法
|
||||
*/
|
||||
@protocol IOpenAtlasEncryptComponent <NSObject>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入需要处理的数据,生成加密结果返回
|
||||
*
|
||||
* @param needProcessValue 需要加密的数据
|
||||
*
|
||||
* @param authCode SDK授权码
|
||||
*
|
||||
* @return 返回加密的字符串,失败时返回nil
|
||||
*/
|
||||
- (NSString*) atlasSafeEncrypt: (NSString*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol IOpenDataCollectionComponent <NSObject>
|
||||
|
||||
/**
|
||||
* 设置用户昵称
|
||||
* @param nick, 用户昵称
|
||||
* @return YES, 设置后值发生改变, NO, 设置失败或值未发生改变
|
||||
*/
|
||||
- (BOOL) setNick:(NSString*) nick;
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户昵称
|
||||
*
|
||||
* @return 用户昵称,获取失败返回nil
|
||||
*/
|
||||
- (NSString*) getNick;
|
||||
|
||||
@end
|
||||
+93
@@ -0,0 +1,93 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#ifndef OpenSecurityGuardSDK_IOpenDynamicDataEncryptComponent_h
|
||||
#define OpenSecurityGuardSDK_IOpenDynamicDataEncryptComponent_h
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 动态加解密接口
|
||||
*/
|
||||
@protocol IOpenDynamicDataEncryptComponent <NSObject>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 动态加密字符串值
|
||||
*
|
||||
* @param key string值对应的key
|
||||
*
|
||||
* @return 返回加密结果,加密失败返回nil
|
||||
*/
|
||||
- (NSString*) dynamicEncrypt: (NSString*) plainText;
|
||||
|
||||
|
||||
/**
|
||||
* 动态解密字符串值
|
||||
*
|
||||
* @param cipherText string需要解密的字符串值
|
||||
*
|
||||
* @return 返回解密结果,解密失败返回nil
|
||||
*/
|
||||
- (NSString*) dynamicDecrypt: (NSString*) cipherText;
|
||||
|
||||
/**
|
||||
* 动态加密byte数组
|
||||
*
|
||||
* @param plainByteArray 待加密的byte数组
|
||||
*
|
||||
* @return 返回加密结果,加密失败返回nil
|
||||
*/
|
||||
- (NSData*) dynamicEncryptByteArray: (NSData*) plainByteArray;
|
||||
|
||||
|
||||
/**
|
||||
* 动态解密byte数组
|
||||
*
|
||||
* @param plainByteArray 需要解密的byte数组
|
||||
*
|
||||
* @return 返回解密结果,解密失败返回nil
|
||||
*/
|
||||
- (NSData*) dynamicDecryptByteArray: (NSData*) cipherByteArray;
|
||||
|
||||
/**
|
||||
* 动态加密字符串值(加解密过程依赖设备硬件)
|
||||
*
|
||||
* @param key string值对应的key
|
||||
*
|
||||
* @return 返回加密结果,加密失败返回nil
|
||||
*/
|
||||
- (NSString*) dynamicEncryptDDp: (NSString*) plainText;
|
||||
|
||||
/**
|
||||
* 动态解密字符串值(加解密过程依赖设备硬件)
|
||||
*
|
||||
* @param cipherText string需要解密的字符串值
|
||||
*
|
||||
* @return 返回解密结果,解密失败返回nil
|
||||
*/
|
||||
- (NSString*) dynamicDecryptDDp: (NSString*) cipherText;
|
||||
|
||||
/**
|
||||
* 动态加密byte数组(加解密过程依赖设备硬件)
|
||||
*
|
||||
* @param plainByteArray 待加密的byte数组
|
||||
*
|
||||
* @return 返回加密结果,加密失败返回nil
|
||||
*/
|
||||
- (NSData*) dynamicEncryptByteArrayDDp: (NSData*) plainByteArray;
|
||||
|
||||
/**
|
||||
* 动态解密byte数组(加解密过程依赖设备硬件)
|
||||
*
|
||||
* @param plainByteArray 需要解密的byte数组
|
||||
*
|
||||
* @return 返回解密结果,解密失败返回nil
|
||||
*/
|
||||
- (NSData*) dynamicDecryptByteArrayDDp: (NSData*) cipherByteArray;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+270
@@ -0,0 +1,270 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#ifndef OpenSecurityGuardSDK_IOpenDynamicDataStoreComponent_h
|
||||
#define OpenSecurityGuardSDK_IOpenDynamicDataStoreComponent_h
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 动态存储接口
|
||||
*/
|
||||
@protocol IOpenDynamicDataStoreComponent <NSObject>
|
||||
|
||||
|
||||
#pragma mark DDS interface
|
||||
/**
|
||||
* 获取动态存储中的string值
|
||||
* @param key string值对应的key
|
||||
* @return 返回存储的value,如果没有找到,返回nil
|
||||
*/
|
||||
- (NSString*) getString: (NSString*) key;
|
||||
|
||||
|
||||
/**
|
||||
* 向动态存储中存储string
|
||||
* @param value 要存储的string
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putString: (NSString*) value forKey: (NSString*) key;
|
||||
|
||||
|
||||
/**
|
||||
* 删除key对应的string值
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeStringForKey: (NSString*) key;
|
||||
|
||||
/**
|
||||
* 获取动态存储中的data值
|
||||
* @param key data值对应的key
|
||||
* @return 存储中存储的value,如果没有找到,返回nil
|
||||
*/
|
||||
- (NSData*) getData: (NSString*) key;
|
||||
|
||||
|
||||
/**
|
||||
* 向动态存储中存储data
|
||||
* @param value 要存储的data(存入的data size不宜过大)
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putData: (NSData*) value forKey: (NSString*) key;
|
||||
|
||||
|
||||
/**
|
||||
* 删除key对应的data值
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeDataForKey: (NSString*) key;
|
||||
|
||||
|
||||
/**
|
||||
* 获取动态存储中的integer值
|
||||
* @param key integer值对应的key
|
||||
* @return 存储中存储的value,如果没有找到,返回0
|
||||
*/
|
||||
- (NSInteger) getInteger: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 向动态存储中存储integer
|
||||
* @param value 要存储的integer
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putInteger: (NSInteger) value forKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除key对应的integer值
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeIntegerForKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取动态存储中的float值
|
||||
* @param key float值对应的key
|
||||
* @return 存储中存储的value,如果没有找到,返回0.0f
|
||||
*/
|
||||
- (float) getFloat: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 向动态存储中存储float
|
||||
* @param value 要存储的float
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putFloat: (float) value forKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除key对应的float值
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeFloatForKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取动态存储中的double值
|
||||
* @param key double值对应的key
|
||||
* @return 存储中存储的value,如果没有找到,返回0.0f
|
||||
*/
|
||||
- (double) getDouble: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 向动态存储中存储double
|
||||
* @param value 要存储的double
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putDouble: (double) value forKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除key对应的double值
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeDoubleForKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取动态存储中的bool值
|
||||
* @param key bool值对应的key
|
||||
* @return 存储中存储的value,如果没有找到,返回NO
|
||||
*/
|
||||
- (BOOL) getBool: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 向动态存储中存储bool
|
||||
* @param value 要存储的bool
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putBool: (BOOL) value forKey: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除key对应的boll值
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeBoolForKey: (NSString*) key;
|
||||
|
||||
#pragma mark DDp interface
|
||||
/**
|
||||
* 获取动态存储中的string值(加解密过程依赖设备硬件)
|
||||
* @param key string值对应的key
|
||||
* @return 返回存储的value,如果没有找到,返回nil
|
||||
*/
|
||||
- (NSString*) getStringDDp: (NSString*) key;
|
||||
|
||||
/**
|
||||
* 向动态存储中存储string(加解密过程依赖设备硬件)
|
||||
* @param value 要存储的string
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putStringDDp: (NSString*) value forKey: (NSString*) key;
|
||||
|
||||
/**
|
||||
* 删除key对应的string值(加解密过程依赖设备硬件)
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeStringForKeyDDp: (NSString*) key;
|
||||
|
||||
/**
|
||||
* 获取动态存储中的data值(加解密过程依赖设备硬件)
|
||||
* @param key data值对应的key
|
||||
* @return 存储中存储的value,如果没有找到,返回nil
|
||||
*/
|
||||
- (NSData*) getDataDDp: (NSString*) key;
|
||||
|
||||
/**
|
||||
* 向动态存储中存储data(加解密过程依赖设备硬件)
|
||||
* @param value 要存储的data(存入的data size不宜过大)
|
||||
* @param key 存储值要使用的key
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (int) putDataDDp: (NSData*) value forKey: (NSString*) key;
|
||||
|
||||
/**
|
||||
* 删除key对应的data值(加解密过程依赖设备硬件)
|
||||
* @param key 删除操作的结果
|
||||
*/
|
||||
- (void) removeDataForKeyDDp: (NSString*) key;
|
||||
|
||||
|
||||
#pragma mark DDpEx interface
|
||||
/**
|
||||
* 获取本地存储的String数据
|
||||
* @param key 存储值要使用的key
|
||||
* @param flag 扩展参数,缺省为0
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (NSString*) getStringDDpEx: (NSString*) key flag: (int) flag;
|
||||
|
||||
/**
|
||||
* 存储String数据
|
||||
* @param value 存储的value
|
||||
* @param key value对应的key
|
||||
* @return 存储操作的结果
|
||||
*/
|
||||
- (BOOL) putStringDDpEx: (NSString*) value forKey: (NSString*) key flag: (int) flag;
|
||||
|
||||
/**
|
||||
* 删除本地存储的String数据
|
||||
* @param key 存储值要使用的key
|
||||
* @param flag 扩展参数,缺省为0
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (void) removeStringDDpEx: (NSString*) key flag: (int) flag;
|
||||
|
||||
/**
|
||||
* 获取本地存储的Data数据
|
||||
* @param 存储值要使用的key
|
||||
* @param flag 扩展参数,缺省为0
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (NSData*) getDataDDpEx: (NSString*) key flag: (int) flag;
|
||||
|
||||
|
||||
/**
|
||||
* 存储Data数据
|
||||
* @param value 存储的Data数据
|
||||
* @param key value对应的key
|
||||
* @return 检测token是否存在的结果
|
||||
*/
|
||||
- (BOOL) putDataDDpEx: (NSData*) value forKey: (NSString*) key flag: (int) flag;
|
||||
|
||||
|
||||
/**
|
||||
* 删除本地存储的Data数据
|
||||
* @param 存储值要使用的key
|
||||
* @param flag 扩展参数,缺省为0
|
||||
* @return 存储操作结果
|
||||
*/
|
||||
- (void) removeDataDDpEx: (NSString*) key flag: (int) flag;
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
+30
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#ifndef OpenSecurityGuardSDK_IOpenInitializeComponent_h
|
||||
#define OpenSecurityGuardSDK_IOpenInitializeComponent_h
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 初始化component protocal
|
||||
*/
|
||||
@protocol IOpenInitializeComponent <NSObject>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 初始化接口
|
||||
*
|
||||
* @return 初始化结果
|
||||
*/
|
||||
- (NSInteger) initialize;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
//
|
||||
// IOpenNoCaptchaComponent.h
|
||||
// SecurityGuardSDK
|
||||
//
|
||||
// Created by chenkong on 15/4/29.
|
||||
// Copyright (c) 2015年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CoreGraphics/CGGeometry.h>
|
||||
|
||||
@protocol IOpenNoCaptchaComponent <NSObject>
|
||||
|
||||
|
||||
/**
|
||||
* 初始化无痕验证模块
|
||||
*
|
||||
* @param appKey 接入应用使用的appkey
|
||||
* @param pageName 页面名称
|
||||
* @param screenWidth 表示屏幕的宽度像素值
|
||||
* @param screenHeight 表示屏幕的高度像素值
|
||||
* @param retryTimes 校验重试次数
|
||||
* @param statusCB 回调函数
|
||||
* @param authCode 二方用户请传nil,三方用户请传AuthCode
|
||||
*/
|
||||
-(void) initNoCaptcha: (NSString*) appKey
|
||||
pageName: (NSString*) pageName
|
||||
width: (int) screenWidth
|
||||
height: (int) screenHeight
|
||||
retry: (int) retryTimes
|
||||
status: (void(^)(NSInteger status, CGPoint pt1, CGPoint pt2, NSString* token, NSString* sig, NSString* sessionID))statusCb
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
/**
|
||||
* 写入用户触屏打点数据
|
||||
*
|
||||
* @param touchEvent touch的类型
|
||||
* @param pt 打点的坐标
|
||||
*/
|
||||
-(BOOL) putNoCaptchaTraceRecord: (NSInteger) touchEvent
|
||||
point: (CGPoint) pt;
|
||||
|
||||
/**
|
||||
* 请求进行无线验证
|
||||
*
|
||||
* @param appKey 接入应用使用的appkey
|
||||
* @param statusCB 回调函数
|
||||
*/
|
||||
-(void) noCaptchaVerification: (NSString*)appKey
|
||||
status: (void(^)(NSInteger status, CGPoint pt1, CGPoint pt2, NSString* token, NSString* sig, NSString* sessionID))statusCb;
|
||||
|
||||
/**
|
||||
* 前向化请求,验证接口
|
||||
*
|
||||
* @param methodName 需要调用的Top API名;
|
||||
*
|
||||
* @param authInfo 其他需要的信息,以key-v形式存于authInfo中;
|
||||
*
|
||||
* @param timeout 接口调用超时时间,单位秒,最大不超过22,最小不小于1。
|
||||
*
|
||||
*/
|
||||
- (NSString*) noCaptchaForwardAuth: (NSString *) methodName
|
||||
authInfo: (NSDictionary*) authInfo
|
||||
timeout: (NSInteger) timeout;
|
||||
|
||||
|
||||
@end
|
||||
+34
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// OpenNoCaptchaDefine.h
|
||||
// SecurityGuardSDK
|
||||
//
|
||||
// Created by chenkong on 15/4/29.
|
||||
// Copyright (c) 2015年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
//touch event type
|
||||
extern NSInteger const OPEN_TOUCH_TYPE_BEGAN;
|
||||
extern NSInteger const OPEN_TOUCH_TYPE_MOVED;
|
||||
extern NSInteger const OPEN_TOUCH_TYPE_ENDED;
|
||||
|
||||
|
||||
//status code
|
||||
extern NSInteger const OPEN_NC_INIT_SUCCEED; //101 返回两个渲染坐标
|
||||
extern NSInteger const OPEN_NC_VERI_SUCCEED; //102 返回token,sig,sessionId
|
||||
extern NSInteger const OPEN_NC_RETRY; //103 返回两个渲染坐标
|
||||
extern NSInteger const OPEN_NC_SERVER_FAULT; //104 返回token,sig,sessionId
|
||||
|
||||
//error status code
|
||||
extern NSInteger const OPEN_NC_INVALID_PARA; //1201
|
||||
extern NSInteger const OPEN_NC_NO_MEMORY; //1202
|
||||
extern NSInteger const OPEN_NC_NOT_INIT_YET; //1203
|
||||
extern NSInteger const OPEN_NC_QUEUE_FULL; //1204
|
||||
extern NSInteger const OPEN_NC_RETRY_TO_MAX; //1205
|
||||
extern NSInteger const OPEN_NC_HTTP_NO_TOKEN; //1206
|
||||
extern NSInteger const OPEN_NC_HTTP_REQUEST_FAIL; //1207
|
||||
extern NSInteger const OPEN_NC_SERVER_RETURN_ERROR; //1208
|
||||
extern NSInteger const OPEN_NC_VERI_GET_WUA_FAIL; //1209
|
||||
extern NSInteger const OPEN_NC_VERI_GET_TRACE_FAIL; //1210
|
||||
extern NSInteger const OPEN_NC_VERI_APPKEY_MISMATCH; //1211
|
||||
extern NSInteger const OPEN_NC_VERI_SESSION_EXPIRED; //1212
|
||||
extern NSInteger const OPEN_NC_UNKNOWN_ERROR; //1299
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* User ID 的BizType
|
||||
* */
|
||||
extern const unsigned char BIZ_UID[];
|
||||
|
||||
/**
|
||||
* Item ID 的BizType
|
||||
* */
|
||||
extern const unsigned char BIZ_IID[];
|
||||
|
||||
/**
|
||||
* Trade ID 的BizType
|
||||
* */
|
||||
extern const unsigned char BIZ_TID[];
|
||||
|
||||
|
||||
@protocol IOpenOpenSDKComponent <NSObject>
|
||||
/**
|
||||
* 分析 Open ID
|
||||
*
|
||||
* @param openId openId的数值
|
||||
*
|
||||
* @param appIdKey appId对应的key值
|
||||
*
|
||||
* @param saltKey salt对应的key值
|
||||
*
|
||||
* @param bizType 解析类型
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return openId中包含的指定内容,传人非法参数时返回nil
|
||||
*/
|
||||
- (NSNumber*) analyzeOpenId:(NSString*) openId
|
||||
appIdKey: (NSString*) appIdKey
|
||||
saltKey: (NSString*) saltKey
|
||||
bizType: (NSData*) bizType
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
@end
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#ifndef OpenSecurityGuardSDK_IOpenSecureSignatureComponent_h
|
||||
#define OpenSecurityGuardSDK_IOpenSecureSignatureComponent_h
|
||||
|
||||
@class OpenSecurityGuardParamContext;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 签名接口
|
||||
*/
|
||||
@protocol IOpenSecureSignatureComponent <NSObject>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 发起签名请求
|
||||
*
|
||||
* @param paramContext 包含签名所需要参数的结构体对象
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 签名值,失败时返回nil
|
||||
*/
|
||||
- (NSString*) signRequest: (OpenSecurityGuardParamContext*) paramContext
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
/*
|
||||
* 对cookie进行签名加密
|
||||
*
|
||||
* @param key 计算文件签名时用到的密钥所对应的key
|
||||
* @param data 需要签名加密的cookie数据
|
||||
*/
|
||||
- (NSString*) getSafeCookie: (NSString*) data
|
||||
secretKey: (NSString*) key
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
/**
|
||||
* 签名调用中,OpenSecurityGuardParamContex中paramDict参数中使用到的key
|
||||
*/
|
||||
|
||||
/**
|
||||
* 签名接口入参key,top, umid签名使用
|
||||
*/
|
||||
extern NSString* const OPEN_KEY_SIGN_INPUT;
|
||||
|
||||
|
||||
/**
|
||||
* seedkey,top 签名使用
|
||||
*/
|
||||
extern NSString* const OPEN_KEY_SIGN_SEEDKEY;
|
||||
|
||||
/**
|
||||
* atlaskey,atlas 签名使用
|
||||
*/
|
||||
extern NSString* const OPEN_KEY_SIGN_ATLAS;
|
||||
|
||||
/**
|
||||
* 签名调用中,OpenSecurityGuardParamContex中requestType参数中使用到的值
|
||||
*/
|
||||
|
||||
/**
|
||||
* top签名
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_TOP;
|
||||
|
||||
/**
|
||||
* umid签名
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_UMID;
|
||||
|
||||
/**
|
||||
* 原始top签名(无seekKey)
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_TOP_OLD;
|
||||
|
||||
/**
|
||||
* common hmac sha1签名
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_COMMON_HMAC_SHA1;
|
||||
|
||||
/**
|
||||
* common md5签名
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_COMMON_MD5;
|
||||
|
||||
/**
|
||||
* atlas签名
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_ATLAS;
|
||||
|
||||
/**
|
||||
* 带模拟器检测功能的hmac-sha1签名
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_SIM_HMAC_SHA1;
|
||||
|
||||
/**
|
||||
* Fast atlas签名 签名String长度50
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_ATLAS_FAST;
|
||||
|
||||
/**
|
||||
* Fast atlas签名2
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_ATLAS_FAST2;
|
||||
|
||||
|
||||
/**
|
||||
* 无效签名类型
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_SIGN_INVALID;
|
||||
+285
@@ -0,0 +1,285 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* 各compoent的compoentid,在获取component对象时传入
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* 签名component
|
||||
*/
|
||||
OpenSecureSignatureComponentID,
|
||||
/**
|
||||
* 动态存储component
|
||||
*/
|
||||
OpenDynamicDataStoreComponentID,
|
||||
/**
|
||||
* 静态存储component
|
||||
*/
|
||||
OpenStaticDataStoreComponentID,
|
||||
/**
|
||||
* 初始化component
|
||||
*/
|
||||
OpenInitComponentID,
|
||||
/**
|
||||
* 静态加解密component
|
||||
*/
|
||||
OpenStaticDataEncryptCompnentID,
|
||||
/**
|
||||
* data collection compnent
|
||||
*/
|
||||
OpenDataCollectionCompnentID,
|
||||
/**
|
||||
* dynamic data encrypt componentID
|
||||
*/
|
||||
OpenDynamicDataEncryptComponentID,
|
||||
/**
|
||||
* StaticKeyEncrypt componentID
|
||||
*/
|
||||
OpenStaticKeyEncryptComponentID,
|
||||
/**
|
||||
* UMID componentID
|
||||
*/
|
||||
OpenUMIDComponentID,
|
||||
/**
|
||||
* OpenSDK componentID
|
||||
*/
|
||||
OpenOpenSDKComponentID,
|
||||
/**
|
||||
* AtlasEncrypt ComponentID
|
||||
*/
|
||||
OpenAtlasEncryptComponentID,
|
||||
/**
|
||||
* SimulatorDetect ComponentID
|
||||
*/
|
||||
OpenSimulatorDetectComponentID,
|
||||
/**
|
||||
* NoCpatcha ComponentID
|
||||
*/
|
||||
OpenNoCaptchaComponentID,
|
||||
/**
|
||||
* 无效component
|
||||
*/
|
||||
OpenInvalidComponentID
|
||||
|
||||
} OpenSecurityGuardComponentID;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 签名接口,详细定义见:IOpenSecureSignatureComponent.h
|
||||
*/
|
||||
@protocol IOpenSecureSignatureComponent;
|
||||
|
||||
/**
|
||||
* 动态数据存储接口,详细定义见:IOpenDynamicDataStoreComponent.h
|
||||
*/
|
||||
@protocol IOpenDynamicDataStoreComponent;
|
||||
|
||||
/**
|
||||
* 静态数据存储接口,详细定义见:IOpenStaticDataStoreComponent.h
|
||||
*/
|
||||
@protocol IOpenStaticDataStoreComponent;
|
||||
|
||||
/**
|
||||
* 静态数据存储接口,详细定义见:IOpenStaticDataEncryptComponent.h
|
||||
*/
|
||||
@protocol IOpenStaticDataEncryptComponent;
|
||||
|
||||
/**
|
||||
* 数据采集接口,详细定义见:IOpenDataCollectionComponent.h
|
||||
*/
|
||||
@protocol IOpenDataCollectionComponent;
|
||||
|
||||
/**
|
||||
* 动态数据加密接口,详细定义见:IOpenDynamicDataEncryptComponent.h
|
||||
*/
|
||||
@protocol IOpenDynamicDataEncryptComponent;
|
||||
|
||||
/**
|
||||
* 静态密钥安全加密接口,详细定义见:IOpenStaticKeyEncryptComponent.h
|
||||
*/
|
||||
@protocol IOpenStaticKeyEncryptComponent;
|
||||
|
||||
/**
|
||||
* 获取 umid 接口, 详细定义见 IUMIDComponent.h
|
||||
*/
|
||||
@protocol IOpenUMIDComponent;
|
||||
|
||||
/**
|
||||
* 获取 openSDK 接口, 详细定义见 IOpenOpenSDKComponent.h
|
||||
*/
|
||||
@protocol IOpenOpenSDKComponent;
|
||||
|
||||
/**
|
||||
* 增强加解密接口, 详细定义见 IOpenAtlasEncryptComponent.h
|
||||
*/
|
||||
@protocol IOpenAtlasEncryptComponent;
|
||||
|
||||
/**
|
||||
* NoCaptcha接口, 详细定义见 IOpenNocpatchaComponent.h
|
||||
*/
|
||||
@protocol IOpenNoCaptchaComponent;
|
||||
|
||||
/**
|
||||
* 模拟器检测接口, 详细定义见 IOpenSimulatorDetectComponent.h
|
||||
*/
|
||||
@protocol IOpenSimulatorDetectComponent;
|
||||
|
||||
/**
|
||||
* SecurityGuardSDK管理类
|
||||
*/
|
||||
@interface OpenSecurityGuardManager : NSObject
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取SecurityGuardManager单例对象
|
||||
*
|
||||
* @return SecurityGuardManager单例对象
|
||||
*/
|
||||
+ (OpenSecurityGuardManager*) getInstance;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取安全签名接口
|
||||
*
|
||||
* @return 返回签名接口,失败时nil
|
||||
*/
|
||||
- (id<IOpenSecureSignatureComponent>) getSecureSignatureComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取动态数据存储接口
|
||||
*
|
||||
* @return 返回动态数据存储接口,失败时nil
|
||||
*/
|
||||
- (id<IOpenDynamicDataStoreComponent>) getDynamicDataStoreComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取静态数据存储接口
|
||||
*
|
||||
* @return 返回静态数据存储接口,失败时nil
|
||||
*/
|
||||
- (id<IOpenStaticDataStoreComponent>) getStaticDataStoreComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取静态数据加密接口
|
||||
*
|
||||
* @return 返回模拟器检测模块,失败时nil
|
||||
*/
|
||||
- (id<IOpenStaticDataEncryptComponent>) getStaticDataEncryptComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取数据采集接口
|
||||
*
|
||||
* @return 返回数据采集接口,失败时返回nil
|
||||
*/
|
||||
- (id<IOpenDataCollectionComponent>) getDataCollectionComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取动态数据存储接口
|
||||
*
|
||||
* @return 返回动态数据存储接口,失败时返回nil
|
||||
*/
|
||||
- (id<IOpenDynamicDataEncryptComponent>) getDynamicDataEncryptComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取静态密钥安全加解密接口
|
||||
*
|
||||
* @return 返回静态密钥安全加解密接口,失败时返回nil
|
||||
*/
|
||||
- (id<IOpenStaticKeyEncryptComponent>) getStaticKeyEncryptComp;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取UMID接口
|
||||
*
|
||||
* @return 返回UMID接口,失败返回nil
|
||||
*/
|
||||
- (id<IOpenUMIDComponent>) getUMIDComp;
|
||||
|
||||
/**
|
||||
* 获取OpenSDK接口
|
||||
*
|
||||
* @return 返回OpenSDK接口,失败返回nil
|
||||
*/
|
||||
- (id<IOpenOpenSDKComponent>) getOpenOpenSDKComp;
|
||||
|
||||
/**
|
||||
* 获取增强加密接口
|
||||
*
|
||||
* @return 返回增强加密接口,失败返回nil
|
||||
*/
|
||||
- (id<IOpenAtlasEncryptComponent>) getAtlasEncryptComp;
|
||||
|
||||
/**
|
||||
* 获取NoCaptcha接口
|
||||
*
|
||||
* @return 返回NoCaptcha接口,失败返回nil
|
||||
*/
|
||||
- (id<IOpenNoCaptchaComponent>) getNoCaptchaComp;
|
||||
|
||||
/**
|
||||
* 获取模拟器检测接口
|
||||
*
|
||||
* @return 返回模拟器检测接口,失败返回nil
|
||||
*/
|
||||
- (id<IOpenSimulatorDetectComponent>) getSimulatorDetectComp;
|
||||
|
||||
|
||||
/**
|
||||
* 根据传入的component id获取对应的component对象
|
||||
*
|
||||
* @param componentId 目标compoent的id
|
||||
*
|
||||
* @return 返回componentId对应的component对象,失败时返回nil
|
||||
*/
|
||||
- (id) getComponent: (OpenSecurityGuardComponentID) componentId;
|
||||
|
||||
/**
|
||||
* 根据传入的 protocol 获取接口
|
||||
*
|
||||
* @param protocol 要获取的 interface
|
||||
*
|
||||
* @return 返回的实现 protocol 的对象
|
||||
*/
|
||||
- (id) getInterface: (Protocol*) protocol;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取sdk当前版本号
|
||||
*
|
||||
* @return sdk当前版本号
|
||||
*/
|
||||
- (NSString*) getSDKVersion;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 是否为外部版本的无线保镖SDK
|
||||
*
|
||||
* @return 是否为外部版本的无线保镖SDK
|
||||
*/
|
||||
- (BOOL) isOpen;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* OpenSecuritGuardSDK的参数结构体
|
||||
*/
|
||||
@interface OpenSecurityGuardParamContext : NSObject
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 应用当前使用的appkey
|
||||
*/
|
||||
@property (nonatomic, strong) NSString* appKey;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 调用接口的接口的类型标识,类型定义见各component的头文件定义
|
||||
*/
|
||||
@property (nonatomic, assign) NSInteger requestType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入业务参数使用的dictionary,使用的key值见各component的头文件定义
|
||||
*/
|
||||
@property (nonatomic, strong) NSMutableDictionary* paramDict;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据传入的参数生成参数结构体对象
|
||||
*
|
||||
* @param appKey appkey,应用当前使用的appkey
|
||||
* @param paramDict 存储业务参数的dictionary对象
|
||||
* @param requestType 请求类型
|
||||
*
|
||||
* @return 生成的参数结构体对象, autorelease对象
|
||||
*/
|
||||
+ (OpenSecurityGuardParamContext*) createParamContextWithAppKey: (NSString*) appKey
|
||||
paramDict: (NSDictionary*) paramDict
|
||||
requestType: (NSInteger) requestType;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+20
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// SecurityGuardSDK version 2.3.0
|
||||
//
|
||||
|
||||
#ifndef SecurityGuardSDK_IOpenSimulatorDetectComponent_h
|
||||
#define SecurityGuardSDK_IOpenSimulatorDetectComponent_h
|
||||
|
||||
/**
|
||||
* 模拟器检测接口
|
||||
*/
|
||||
@protocol IOpenSimulatorDetectComponent <NSObject>
|
||||
|
||||
/**
|
||||
* 判断当前设备是否是iOS模拟器
|
||||
*/
|
||||
- (BOOL) isSimulator;
|
||||
|
||||
@end
|
||||
|
||||
#endif
|
||||
+136
@@ -0,0 +1,136 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
/**
|
||||
* 静态加解密算法
|
||||
*/
|
||||
@protocol IOpenStaticDataEncryptComponent <NSObject>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入加密算法,使用的key,需要处理的数据,生成加密结果返回
|
||||
*
|
||||
* @param mode 算法,定义见OpenStaticDataStoreDefine.h
|
||||
*
|
||||
* @param key 安全key,用于获取内嵌的keyData
|
||||
*
|
||||
* @param needProcessValue 需要加密的数据
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 返回加密的字符串,失败时返回nil
|
||||
*/
|
||||
- (NSString*) staticSafeEncrypt: (NSInteger) mode
|
||||
forKey: (NSString*) key
|
||||
forNeedProcessValue: (NSString*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入解密算法,使用的key,需要处理的数据,生成解密结果返回
|
||||
*
|
||||
* @param mode 算法,定义见OpenStaticDataStoreDefine.h
|
||||
*
|
||||
* @param key 安全key,用于获取内嵌的keyData
|
||||
*
|
||||
* @param needProcessValue 需要加密的数据
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 返回解密的字符串,失败时返回nil
|
||||
*/
|
||||
- (NSString*) staticSafeDecrypt: (NSInteger) mode
|
||||
forKey: (NSString*) key
|
||||
forNeedProcessValue: (NSString*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入加密算法,使用的key,需要处理的数据,生成加密的字符数组结果返回
|
||||
*
|
||||
* @param mode 算法,定义见OpenStaticDataStoreDefine.h
|
||||
*
|
||||
* @param key 安全key,用于获取内嵌的keyData
|
||||
*
|
||||
* @param needProcessValue 需要加密的数据
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 返回加密的字符数组结果,失败时返回nil
|
||||
*/
|
||||
- (NSData*) staticBinarySafeEncrypt: (NSInteger) mode
|
||||
forKey: (NSString*) key
|
||||
forNeedProcessValue: (NSData*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入解密算法,使用的key,需要处理的数据,生成解密的字符数组结果返回
|
||||
*
|
||||
* @param mode 算法,定义见OpenStaticDataStoreDefine.h
|
||||
*
|
||||
* @param key 安全key,用于获取内嵌的keyData
|
||||
*
|
||||
* @param needProcessValue 需要解密的数据
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 返回解密的字符数组结果,失败时返回nil
|
||||
*/
|
||||
- (NSData*) staticBinarySafeDecrypt: (NSInteger) mode
|
||||
forKey: (NSString*)key
|
||||
forNeedProcessValue: (NSData*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入加密算法,使用的key,需要处理的数据,生成加密的字符数组结果返回(与staticBinarySafeEncrypt接口区别在于:对加密结果不做base64)
|
||||
*
|
||||
* @param mode 算法,定义见OpenStaticDataStoreDefine.h
|
||||
*
|
||||
* @param key 安全key,用于获取内嵌的keyData
|
||||
*
|
||||
* @param needProcessValue 需要加密的数据
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 返回加密的字符数组结果,失败时返回nil
|
||||
*/
|
||||
- (NSData*) staticBinarySafeEncryptNoB64: (NSInteger) mode
|
||||
forKey: (NSString*) key
|
||||
forNeedProcessValue: (NSData*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 传入解密算法,使用的key,需要处理的数据,生成解密的字符数组结果返回(staticBinarySafeEncryptNoB64对应的解密接口)
|
||||
*
|
||||
* @param mode 算法,定义见OpenStaticDataStoreDefine.h
|
||||
*
|
||||
* @param key 安全key,用于获取内嵌的keyData
|
||||
*
|
||||
* @param needProcessValue 需要解密的数据
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return 返回解密的字符数组结果,失败时返回nil
|
||||
*/
|
||||
- (NSData*) staticBinarySafeDecryptNoB64: (NSInteger) mode
|
||||
forKey: (NSString*)key
|
||||
forNeedProcessValue: (NSData*) needProcessValue
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
+42
@@ -0,0 +1,42 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* 静态加密与解密中使用加密算法
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* arcfour算法
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_CIPHER_ARCFOUR;
|
||||
|
||||
|
||||
/**
|
||||
* aes128算法
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_CIPHER_AES128;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* aes192算法
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_CIPHER_AES192;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* aes256算法
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_CIPHER_AES256;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 无效算法
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_CIPHER_INVALID;
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#ifndef OpenSecurityGuardSDK_IOpenStaticDataStoreComponent_h
|
||||
#define OpenSecurityGuardSDK_IOpenStaticDataStoreComponent_h
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 静态解密接口
|
||||
*/
|
||||
@protocol IOpenStaticDataStoreComponent <NSObject>
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据传入的key,返回key的种类,种类定义请见staticdatadefine.h
|
||||
*
|
||||
* @param key 要判断类型的key
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return key的类型,定义请见staticdatadefine.h
|
||||
*/
|
||||
- (NSInteger) getKeyType: (NSString*) key
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据index找到对应的appkey(index从0开始,按在无线保镖网站生成加密文件时填写的顺序排列)
|
||||
*
|
||||
* @param index key的顺序
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return index对应的appkey,调用失败时返回nil
|
||||
*/
|
||||
- (NSString*) getAppKey: (NSNumber*) index
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据key,找到对应的extradata
|
||||
*
|
||||
* @param key 目标extradata对应的key
|
||||
*
|
||||
* @param authCode SDK的授权码,不传或为空串,使用默认加密文件
|
||||
*
|
||||
* @return key对应的extradata,调用失败时返回nil
|
||||
*/
|
||||
- (NSString*) getExtraData: (NSString*) key
|
||||
authCode: (NSString*) authCode;
|
||||
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
+35
@@ -0,0 +1,35 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* getKeytype返回值的定义,详细含义请见接口文档或无线保镖sdk网站
|
||||
*/
|
||||
|
||||
/**
|
||||
* appkey类型
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_KEYTYPE_APPKEY;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* security data类型
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_KEYTYPE_SECURE_EXTRA;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* extra data类型
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_KEYTYPE_EXTRA_DATA;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 无效key类型
|
||||
*/
|
||||
extern NSInteger const OPEN_ENUM_KEYTYPE_INVALID;
|
||||
+84
@@ -0,0 +1,84 @@
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@protocol IOpenStaticKeyEncryptComponent <NSObject>
|
||||
|
||||
/**
|
||||
* 存储安全凭证到本地存储
|
||||
*
|
||||
* @param key 数据对应的Key
|
||||
*
|
||||
* @param value 要存储的安全凭证
|
||||
*
|
||||
* @return 保存状态 1,保存成功 2,覆盖保存 0,保存失败
|
||||
*/
|
||||
- (int) saveSecret: (NSString*) key value: (NSData*) value;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* key对应的安全凭证是否存在
|
||||
*
|
||||
* @param key 安全凭证对应的key
|
||||
*
|
||||
* @return 存在状态 true,存在。false,不存在
|
||||
*/
|
||||
- (BOOL) isSecretExist: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除安全凭证项
|
||||
*
|
||||
* @param key 数据对应的key
|
||||
*
|
||||
* @return 删除结果状态码 1,没有需要被删除的项 2,删除成功 0,删除失败
|
||||
*/
|
||||
- (int) removeSecret: (NSString*) key;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 加密秘钥数据
|
||||
*
|
||||
* @param mode 加密算法
|
||||
*
|
||||
* @param key 加密使用的key
|
||||
*
|
||||
* @param data 需要加密的数据
|
||||
*
|
||||
* @return 加密结果数组
|
||||
*/
|
||||
- (NSData*) encrypt: (NSInteger) mode key: (NSString*) key data: (NSData*) data;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 解密秘钥数据
|
||||
*
|
||||
* @param mode 解密算法
|
||||
*
|
||||
* @param key 解密使用的key
|
||||
*
|
||||
* @param data 需要解密的数据
|
||||
*
|
||||
* @return 解密结果数组
|
||||
*/
|
||||
- (NSData*) decrypt: (NSInteger) mode key: (NSString*) key data: (NSData*) data;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 使用key获取对应的value,再作为key,加密dataKey对应的value
|
||||
*
|
||||
* @param mode 加密算法
|
||||
*
|
||||
* @param key 保存到NSUserdefault里面的key-value对的key值
|
||||
*
|
||||
* @param dataKey 保存到NSUserdefault里面的key-value对的key值
|
||||
*
|
||||
* @return 加密结果byte数组
|
||||
*/
|
||||
- (NSData*) encryptSecretData: (NSInteger) mode key: (NSString*) key dataKey: (NSString*) dataKey;
|
||||
|
||||
@end
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
//
|
||||
// OpenSecurityGuardSDK version 2.1.0
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* 安全凭证加解密模块使用加密算法
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* aes128算法
|
||||
*/
|
||||
extern NSInteger const OPEN_CIPHER_AES128;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* aes192算法
|
||||
*/
|
||||
extern NSInteger const OPEN_CIPHER_AES192;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* aes256算法
|
||||
*/
|
||||
extern NSInteger const OPEN_CIPHER_AES256;
|
||||
|
||||
|
||||
/**
|
||||
* 无效算法
|
||||
*/
|
||||
extern NSInteger const OPEN_CIPHER_INVALID;
|
||||
|
||||
/**
|
||||
* 安全凭证加解密模块使用的错误码
|
||||
*/
|
||||
|
||||
/**
|
||||
* seedSecret存储失败
|
||||
*/
|
||||
extern NSInteger const OPEN_SAVE_FAILED;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* seedSecret覆盖成功
|
||||
*/
|
||||
extern NSInteger const OPEN_OVERRIDE_SUCCESS;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* seedSecret存储成功
|
||||
*/
|
||||
extern NSInteger const OPEN_SAVE_SUCCESS;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除 seedSecret失败
|
||||
*/
|
||||
extern NSInteger const OPEN_REMOVE_FAILED;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除 seedSecret成功
|
||||
*/
|
||||
extern NSInteger const OPEN_REMOVE_SUCCESS;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 删除失败,没有此项
|
||||
*/
|
||||
extern NSInteger const OPEN_NO_SUCH_ITEM;
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
//
|
||||
// IOpenUMIDComponent.h
|
||||
// OpenSecurityGuardSDK
|
||||
//
|
||||
// Created by lifengzhong on 14/8/13.
|
||||
// Copyright (c) 2014年 Li Fengzhong. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
/**
|
||||
* umid 使用的环境变量定义
|
||||
*/
|
||||
typedef enum {
|
||||
/**
|
||||
* 线上环境
|
||||
*/
|
||||
SDP_ENVIRONMENT_ONLINE = 0,
|
||||
/**
|
||||
* 预发布环境
|
||||
*/
|
||||
SDP_ENVIRONMENT_PRE,
|
||||
/**
|
||||
* 日常环境
|
||||
*/
|
||||
SDP_ENVIRONMENT_DAILY,
|
||||
/**
|
||||
* 美国线上环境
|
||||
*/
|
||||
SDP_ENVIRONMENT_ONLINE_US,
|
||||
/**
|
||||
* 未设置
|
||||
*/
|
||||
SDP_ENVIRONMENT_UNSET
|
||||
|
||||
} SDP_ENVIRONMENT;
|
||||
|
||||
@protocol IOpenUMIDComponent <NSObject>
|
||||
|
||||
/**
|
||||
* 初始化 umid
|
||||
*
|
||||
* @param resultHandler 初始化结果回调,本函数必须在主线程内完成(推荐在 appdelegate中,应用启动时调用)
|
||||
*
|
||||
* @return 调用成功结果
|
||||
*/
|
||||
- (void) registerInitListener: (void (^) (NSString* securityToken, NSError* error)) listener;
|
||||
|
||||
/**
|
||||
* 初始化umid
|
||||
*
|
||||
* @param appKey appkey,注意此值要与 dpEnv 对应,线上环境对应传线上的 appkey,以此类推
|
||||
* @param sdpEnv 接入应用当前的环境,包括线上,预发,线上
|
||||
* @param authCode 授权码,指定umid使用哪个加密文件,注意入参appkey在authCode对应的图片中要存在
|
||||
* @param handler 初始化结果回调,本函数必须在主线程内完成(推荐在 appdelegate中,应用启动时调用)
|
||||
*
|
||||
*/
|
||||
- (BOOL) initUMID: (NSString*) appKey
|
||||
environment: (SDP_ENVIRONMENT) sdpEnv
|
||||
authCode: (NSString*) authCode
|
||||
handler: (void (^) (NSString* securityToken, NSError* error)) handler;
|
||||
|
||||
/**
|
||||
* 返回UMID Token,长度为32的字符串
|
||||
*
|
||||
* @return 如果失败,返回内容为24个0的字符串
|
||||
*/
|
||||
- (NSString*) getSecurityToken;
|
||||
|
||||
/**
|
||||
* 返回UMID Token,长度为32的字符串
|
||||
*
|
||||
* @return 如果失败,返回内容为24个0的字符串
|
||||
*/
|
||||
- (NSString*) getSecurityToken: (SDP_ENVIRONMENT)envForToken;
|
||||
|
||||
/**
|
||||
* 设置UMID线上访问地址
|
||||
*
|
||||
* @param host 要设置的线上地址,如ynuf.alipay.com,不要带协议头,不要带后面的参数,只能传纯host地址
|
||||
*/
|
||||
- (void) setOnlineHost: (NSString*) host;
|
||||
|
||||
/**
|
||||
* 清空 umid 本地数据(mock接口,正常情况不要调用!)
|
||||
*/
|
||||
- (void) resetClientData: (SDP_ENVIRONMENT) env;
|
||||
|
||||
/**
|
||||
* 获取 umid
|
||||
*
|
||||
* @return umid版本号
|
||||
*/
|
||||
- (NSString*) getUMIDVersion;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.alimobilesec.SecurityGuardSDK</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>SecurityGuardSDK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>5.1.94</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Binary file not shown.
Reference in New Issue
Block a user