Skip to content

Commit

Permalink
Merge pull request #23 from Ashton-W/aw-readme
Browse files Browse the repository at this point in the history
Syntax highlighting in README
  • Loading branch information
nabla-c0d3 committed Oct 17, 2015
2 parents 9edb8ed + 356ce83 commit e6b558a
Showing 1 changed file with 30 additions and 24 deletions.
54 changes: 30 additions & 24 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ Sample Usage

TrustKit can be deployed using CocoaPods, by adding the following line to your Podfile:

pod 'TrustKit'
```ruby
pod 'TrustKit'
```

Then run:

$ pod install
```sh
$ pod install
```

Then, enabling SSL pinning globally in the App only requires initializing TrustKit
with a pinning policy (domains, Subject Public Key Info hashes, and additional settings).
Expand All @@ -88,28 +92,30 @@ The policy can be configured within the App's Info.plist:

Alternatively, the pinning policy can be set programmatically:

NSDictionary *trustKitConfig;
trustKitConfig = @{
@"www.datatheorem.com" : @{
kTSKPublicKeyAlgorithms : @[kTSKAlgorithmRsa2048],
kTSKPublicKeyHashes : @[
@"HXXQgxueCIU5TTLHob/bPbwcKOKw6DkfsTWYHbxbqTY=",
@"0SDf3cRToyZJaMsoS17oF72VMavLxj/N7WBNasNuiR8="
],
kTSKEnforcePinning : @NO,
kTSKReportUris : @[@"http://report.datatheorem.com/log_report"],
},
@"yahoo.com" : @{
kTSKPublicKeyAlgorithms : @[kTSKAlgorithmRsa4096],
kTSKPublicKeyHashes : @[
@"TQEtdMbmwFgYUifM4LDF+xgEtd0z69mPGmkp014d6ZY=",
@"rFjc3wG7lTZe43zeYTvPq8k4xdDEutCmIhI5dn4oCeE=",
],
kTSKIncludeSubdomains : @YES
}
};

[TrustKit initializeWithConfiguration:trustKitConfig];
```objc
NSDictionary *trustKitConfig;
trustKitConfig = @{
@"www.datatheorem.com" : @{
kTSKPublicKeyAlgorithms : @[kTSKAlgorithmRsa2048],
kTSKPublicKeyHashes : @[
@"HXXQgxueCIU5TTLHob/bPbwcKOKw6DkfsTWYHbxbqTY=",
@"0SDf3cRToyZJaMsoS17oF72VMavLxj/N7WBNasNuiR8="
],
kTSKEnforcePinning : @NO,
kTSKReportUris : @[@"http://report.datatheorem.com/log_report"],
},
@"yahoo.com" : @{
kTSKPublicKeyAlgorithms : @[kTSKAlgorithmRsa4096],
kTSKPublicKeyHashes : @[
@"TQEtdMbmwFgYUifM4LDF+xgEtd0z69mPGmkp014d6ZY=",
@"rFjc3wG7lTZe43zeYTvPq8k4xdDEutCmIhI5dn4oCeE=",
],
kTSKIncludeSubdomains : @YES
}
};

[TrustKit initializeWithConfiguration:trustKitConfig];
```
Once TrustKit has been initialized, all SSL connections initiated by Apple
frameworks within the App will verify the server' certificate chains against the
Expand Down

0 comments on commit e6b558a

Please sign in to comment.