TrustKit은 iOS 12+, MacOS 10.13+, TVOS 12+ 또는 WatchOS 4+ 앱에 SSL Public Key 고정 및보고를 쉽게 배포 할 수있는 오픈 소스 프레임 워크입니다. Swift 및 Objective-C 앱을 모두 지원합니다.
Android 앱에서 SSL 고정/보고가 필요한 경우 우리는 또한 https://github.com/datatheorem/trustkit-android에서 Android for Android를 출시했습니다.
Trustkit은 다음과 같은 기능을 제공합니다.
앱에 SSL 고정을 배포하려면 고정 정책 (도메인, 주제 공개 키 정보 해시 및 추가 설정)으로 TrustKit을 초기화해야합니다.
정책은 앱의 Info.plist 내에서 구성 할 수 있습니다.
또는 고정 정책은 프로그래밍 방식으로 설정할 수 있습니다.
NSDictionary *trustKitConfig =
@{
kTSKSwizzleNetworkDelegates : @ NO ,
kTSKPinnedDomains : @{
@" www.datatheorem.com " : @{
kTSKExpirationDate : @" 2017-12-01 " ,
kTSKPublicKeyHashes : @[
@" HXXQgxueCIU5TTLHob/bPbwcKOKw6DkfsTWYHbxbqTY= " ,
@" 0SDf3cRToyZJaMsoS17oF72VMavLxj/N7WBNasNuiR8= "
],
kTSKEnforcePinning : @ NO ,
},
@" yahoo.com " : @{
kTSKPublicKeyHashes : @[
@" TQEtdMbmwFgYUifM4LDF+xgEtd0z69mPGmkp014d6ZY= " ,
@" rFjc3wG7lTZe43zeYTvPq8k4xdDEutCmIhI5dn4oCeE= " ,
],
kTSKIncludeSubdomains : @ YES
}
}};
[TrustKit initSharedInstanceWithConfiguration: trustKitConfig];이 정책은 신속한 앱에서 프로그래밍 방식으로 설정할 수도 있습니다.
let trustKitConfig = [
kTSKSwizzleNetworkDelegates : false ,
kTSKPinnedDomains : [
" yahoo.com " : [
kTSKExpirationDate : " 2017-12-01 " ,
kTSKPublicKeyHashes : [
" JbQbUG5JMJUoI6brnx0x3vZF6jilxsapbXGVfjhN8Fg= " ,
" WoiWRyIOVNa9ihaBciRSC7XHjliYS9VwUGOIud4PB18= "
] , ] ] ] as [ String : Any ]
TrustKit . initSharedInstance ( withConfiguration : trustKitConfig ) TrustKit이 초기화 된 후 TSKPinningValidator 인스턴스를 Trustkit Singleton에서 검색 할 수 있으며 앱 네트워크 대표에서 SSL 고정 검증을 수행하는 데 사용할 수 있습니다. 예를 들어 nsurlsessiondelegate에서 :
- ( void )URLSession:( NSURLSession *)session
task:( NSURLSessionTask *)task
didReceiveChallenge:( NSURLAuthenticationChallenge *)challenge
completionHandler:( void (^)( NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler {
{
TSKPinningValidator *pinningValidator = [[TrustKit sharedInstance ] pinningValidator ];
// Pass the authentication challenge to the validator; if the validation fails, the connection will be blocked
if (![pinningValidator handleChallenge: challenge completionHandler: completionHandler])
{
// TrustKit did not handle this challenge: perhaps it was not for server trust
// or the domain was not pinned. Fall back to the default behavior
completionHandler ( NSURLSessionAuthChallengePerformDefaultHandling , nil );
}
}자세한 내용은 시작 가이드를 참조하십시오.
Trustkit은 Data Theorem과 Yahoo의 모바일 팀 간의 공동 요법입니다. 자세한 내용은 AUTHORS 참조하십시오.
Trustkit은 MIT 라이센스에 따라 릴리스됩니다. 자세한 내용은 LICENSE 참조하십시오.