GESecurityPolicy.h 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /**
  2. Thinks AFNetworking: https://github.com/AFNetworking/AFNetworking
  3. */
  4. #import <Foundation/Foundation.h>
  5. #if __has_include(<GravityEngineSDK/GEConstant.h>)
  6. #import <GravityEngineSDK/GEConstant.h>
  7. #else
  8. #import "GEConstant.h"
  9. #endif
  10. NS_ASSUME_NONNULL_BEGIN
  11. @interface GESecurityPolicy: NSObject<NSCopying>
  12. @property (nonatomic, assign) BOOL allowInvalidCertificates;
  13. @property (nonatomic, assign) BOOL validatesDomainName;
  14. @property (nonatomic, copy) TDURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge;
  15. + (instancetype)policyWithPinningMode:(GESSLPinningMode)pinningMode;
  16. + (instancetype)defaultPolicy;
  17. - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain;
  18. @end
  19. #ifndef __Require_Quiet
  20. #define __Require_Quiet(assertion, exceptionLabel) \
  21. do \
  22. { \
  23. if ( __builtin_expect(!(assertion), 0) ) \
  24. { \
  25. goto exceptionLabel; \
  26. } \
  27. } while ( 0 )
  28. #endif
  29. #ifndef __Require_noErr_Quiet
  30. #define __Require_noErr_Quiet(errorCode, exceptionLabel) \
  31. do \
  32. { \
  33. if ( __builtin_expect(0 != (errorCode), 0) ) \
  34. { \
  35. goto exceptionLabel; \
  36. } \
  37. } while ( 0 )
  38. #endif
  39. NS_ASSUME_NONNULL_END