Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ | |
| 6 #define NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ | |
| 7 | |
| 8 #include <CoreFoundation/CFString.h> | |
|
Ryan Sleevi
2017/02/06 23:59:05
AIUI, the 'Apple supported way' is CoreFoundation/
mattm
2017/02/09 23:40:17
Done.
| |
| 9 | |
| 10 #include "base/mac/scoped_cftyperef.h" | |
| 11 #include "base/memory/ref_counted.h" | |
| 12 #include "net/base/net_export.h" | |
| 13 #include "net/cert/internal/trust_store.h" | |
| 14 | |
| 15 namespace net { | |
| 16 | |
| 17 // TrustStoreMac is an implementation of TrustStore which uses Mac OS keychain | |
|
Ryan Sleevi
2017/02/06 23:59:05
s/Mac OS/macOS/ to match Apple's naming?
mattm
2017/02/09 23:40:17
Done.
| |
| 18 // to find trust anchors for path building. | |
| 19 class NET_EXPORT TrustStoreMac : public TrustStore { | |
| 20 public: | |
| 21 // Creates a TrustStoreMac which will find anchors that are trusted for | |
| 22 // |policy_oid|. For list of possible policy values, see: | |
| 23 // https://developer.apple.com/reference/security/1667150-certificate_key_and_ trust_servic/1670151-standard_policies_for_specific_c?language=objc | |
| 24 explicit TrustStoreMac(const void* policy_oid); | |
| 25 ~TrustStoreMac() override; | |
| 26 | |
| 27 // Finds certificates in the OS keychains whose Subject matches |name_data|. | |
| 28 // The result is an array of SecCertificateRef. | |
| 29 static base::ScopedCFTypeRef<CFArrayRef> | |
| 30 FindMatchingCertificatesForMacNormalizedSubject(CFDataRef name_data); | |
| 31 | |
| 32 // Filters an array of SecCertificateRef by trust for |policy_oid|, returning | |
| 33 // the results as TrustAnchors in |out_anchors|. | |
| 34 static void FilterTrustedCertificates(CFArrayRef matching_items, | |
| 35 const CFStringRef policy_oid, | |
| 36 TrustAnchors* out_anchors); | |
|
Ryan Sleevi
2017/02/06 23:59:05
On first read, I was surprised to see public class
mattm
2017/02/09 23:40:17
Done.
| |
| 37 | |
| 38 // Gets the Issuer name of |cert|, as normalized by the OS. | |
| 39 static base::ScopedCFTypeRef<CFDataRef> GetMacNormalizedIssuer( | |
| 40 const scoped_refptr<ParsedCertificate>& cert); | |
| 41 | |
| 42 // Finds trust anchors with the Subject |name_data|, which should be | |
| 43 // normalized as by the OS. | |
| 44 void FindTrustAnchorsByMacNormalizedSubject(CFDataRef name_data, | |
| 45 TrustAnchors* matches) const; | |
| 46 | |
| 47 // TrustStore implementation: | |
| 48 void FindTrustAnchorsForCert(const scoped_refptr<ParsedCertificate>& cert, | |
| 49 TrustAnchors* matches) const override; | |
|
Ryan Sleevi
2017/02/06 23:59:05
Suggestion: Order by "interface implementation fir
mattm
2017/02/09 23:40:17
Done.
| |
| 50 | |
| 51 private: | |
| 52 const CFStringRef policy_oid_; | |
| 53 | |
| 54 DISALLOW_COPY_AND_ASSIGN(TrustStoreMac); | |
| 55 }; | |
| 56 | |
| 57 } // namespace net | |
| 58 | |
| 59 #endif // NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ | |
| OLD | NEW |