Archived
status
This commit is contained in:
1 parent
c9c25f86eb
commit
40aaf4fea7
56 files changed
+5683
-179
No files matched your search
@@ -44,10 +44,21 @@ final class PinnedTrustDelegate: NSObject, URLSessionDelegate {
|
||||
completionHandler(.performDefaultHandling, nil)
|
||||
return
|
||||
}
|
||||
if TLSPinning.matchesPinnedCert(trust) {
|
||||
completionHandler(.useCredential, URLCredential(trust: trust))
|
||||
// Apply the fixed self-signed pin only to the pinned LAN deployment
|
||||
// host. Other explicitly configured HTTPS hosts use normal system
|
||||
// trust evaluation (Finding 12). This allows public deployments and
|
||||
// other LAN hosts with valid certificates while never weakening trust
|
||||
// for the default self-signed host.
|
||||
let host = challenge.protectionSpace.host
|
||||
if host == TLSPinning.host {
|
||||
if TLSPinning.matchesPinnedCert(trust) {
|
||||
completionHandler(.useCredential, URLCredential(trust: trust))
|
||||
} else {
|
||||
completionHandler(.cancelAuthenticationChallenge, nil)
|
||||
}
|
||||
} else {
|
||||
completionHandler(.cancelAuthenticationChallenge, nil)
|
||||
// Non-pinned host: let the system evaluate the certificate chain.
|
||||
completionHandler(.performDefaultHandling, nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user