OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "net/cert/internal/trust_store_mac.h" | 5 #include "net/cert/internal/trust_store_mac.h" |
6 | 6 |
7 #include <Security/Security.h> | 7 #include <Security/Security.h> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/mac/foundation_util.h" | 10 #include "base/mac/foundation_util.h" |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 | 220 |
221 } // namespace | 221 } // namespace |
222 | 222 |
223 TrustStoreMac::TrustStoreMac(CFTypeRef policy_oid) | 223 TrustStoreMac::TrustStoreMac(CFTypeRef policy_oid) |
224 : policy_oid_(base::mac::CFCastStrict<CFStringRef>(policy_oid)) { | 224 : policy_oid_(base::mac::CFCastStrict<CFStringRef>(policy_oid)) { |
225 DCHECK(policy_oid_); | 225 DCHECK(policy_oid_); |
226 } | 226 } |
227 | 227 |
228 TrustStoreMac::~TrustStoreMac() = default; | 228 TrustStoreMac::~TrustStoreMac() = default; |
229 | 229 |
230 void TrustStoreMac::FindTrustAnchorsForCert( | 230 void TrustStoreMac::FindIssuers(const scoped_refptr<ParsedCertificate>& cert, |
231 const scoped_refptr<ParsedCertificate>& cert, | 231 TrustAnchors* trust_anchors, |
232 TrustAnchors* out_anchors) const { | 232 ParsedCertificateList* intermediates) const { |
233 base::ScopedCFTypeRef<CFDataRef> name_data = GetMacNormalizedIssuer(cert); | 233 base::ScopedCFTypeRef<CFDataRef> name_data = GetMacNormalizedIssuer(cert); |
234 | 234 |
235 FindTrustAnchorsByMacNormalizedSubject(name_data, out_anchors); | 235 FindTrustAnchorsByMacNormalizedSubject(name_data, trust_anchors); |
| 236 // TODO(eroman): Look for intermediates. |
| 237 } |
| 238 |
| 239 bool TrustStoreMac::IsBlacklisted( |
| 240 const scoped_refptr<ParsedCertificate>& cert) const { |
| 241 return false; |
| 242 // TODO(eroman): Implement. |
236 } | 243 } |
237 | 244 |
238 // static | 245 // static |
239 base::ScopedCFTypeRef<CFArrayRef> | 246 base::ScopedCFTypeRef<CFArrayRef> |
240 TrustStoreMac::FindMatchingCertificatesForMacNormalizedSubject( | 247 TrustStoreMac::FindMatchingCertificatesForMacNormalizedSubject( |
241 CFDataRef name_data) { | 248 CFDataRef name_data) { |
242 base::ScopedCFTypeRef<CFArrayRef> matching_items; | 249 base::ScopedCFTypeRef<CFArrayRef> matching_items; |
243 base::ScopedCFTypeRef<CFMutableDictionaryRef> query( | 250 base::ScopedCFTypeRef<CFMutableDictionaryRef> query( |
244 CFDictionaryCreateMutable(nullptr, 0, &kCFTypeDictionaryKeyCallBacks, | 251 CFDictionaryCreateMutable(nullptr, 0, &kCFTypeDictionaryKeyCallBacks, |
245 &kCFTypeDictionaryValueCallBacks)); | 252 &kCFTypeDictionaryValueCallBacks)); |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
342 base::ScopedCFTypeRef<CFArrayRef> scoped_matching_items = | 349 base::ScopedCFTypeRef<CFArrayRef> scoped_matching_items = |
343 FindMatchingCertificatesForMacNormalizedSubject(name_data); | 350 FindMatchingCertificatesForMacNormalizedSubject(name_data); |
344 if (!scoped_matching_items) | 351 if (!scoped_matching_items) |
345 return; | 352 return; |
346 | 353 |
347 FilterTrustedCertificates(scoped_matching_items.get(), policy_oid_, | 354 FilterTrustedCertificates(scoped_matching_items.get(), policy_oid_, |
348 out_anchors); | 355 out_anchors); |
349 } | 356 } |
350 | 357 |
351 } // namespace net | 358 } // namespace net |
OLD | NEW |