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 #ifndef NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ | 5 #ifndef NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ |
6 #define NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ | 6 #define NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ |
7 | 7 |
8 #include <CoreFoundation/CoreFoundation.h> | 8 #include <CoreFoundation/CoreFoundation.h> |
9 | 9 |
10 #include "base/gtest_prod_util.h" | 10 #include "base/gtest_prod_util.h" |
(...skipping 13 matching lines...) Expand all Loading... |
24 // |policy_oid|. For list of possible policy values, see: | 24 // |policy_oid|. For list of possible policy values, see: |
25 // https://developer.apple.com/reference/security/1667150-certificate_key_and_
trust_servic/1670151-standard_policies_for_specific_c?language=objc | 25 // https://developer.apple.com/reference/security/1667150-certificate_key_and_
trust_servic/1670151-standard_policies_for_specific_c?language=objc |
26 // TODO(mattm): policy oids are actually CFStrings, but the constants are | 26 // TODO(mattm): policy oids are actually CFStrings, but the constants are |
27 // defined as CFTypeRef in older SDK versions. Change |policy_oid| type to | 27 // defined as CFTypeRef in older SDK versions. Change |policy_oid| type to |
28 // const CFStringRef when Chromium switches to building against the 10.11 SDK | 28 // const CFStringRef when Chromium switches to building against the 10.11 SDK |
29 // (or newer). | 29 // (or newer). |
30 explicit TrustStoreMac(CFTypeRef policy_oid); | 30 explicit TrustStoreMac(CFTypeRef policy_oid); |
31 ~TrustStoreMac() override; | 31 ~TrustStoreMac() override; |
32 | 32 |
33 // TrustStore implementation: | 33 // TrustStore implementation: |
34 void FindTrustAnchorsForCert(const scoped_refptr<ParsedCertificate>& cert, | 34 void SyncGetIssuersOf(const ParsedCertificate* cert, |
35 TrustAnchors* matches) const override; | 35 ParsedCertificateList* issuers) override; |
| 36 void GetTrust(const scoped_refptr<ParsedCertificate>& cert, |
| 37 CertificateTrust* trust) const override; |
36 | 38 |
37 private: | 39 private: |
38 FRIEND_TEST_ALL_PREFIXES(TrustStoreMacTest, MultiRootNotTrusted); | 40 FRIEND_TEST_ALL_PREFIXES(TrustStoreMacTest, MultiRootNotTrusted); |
39 FRIEND_TEST_ALL_PREFIXES(TrustStoreMacTest, SystemCerts); | 41 FRIEND_TEST_ALL_PREFIXES(TrustStoreMacTest, SystemCerts); |
40 | 42 |
41 // Finds certificates in the OS keychains whose Subject matches |name_data|. | 43 // Finds certificates in the OS keychains whose Subject matches |name_data|. |
42 // The result is an array of SecCertificateRef. | 44 // The result is an array of SecCertificateRef. |
43 static base::ScopedCFTypeRef<CFArrayRef> | 45 static base::ScopedCFTypeRef<CFArrayRef> |
44 FindMatchingCertificatesForMacNormalizedSubject(CFDataRef name_data); | 46 FindMatchingCertificatesForMacNormalizedSubject(CFDataRef name_data); |
45 | 47 |
46 // Returns the OS-normalized issuer of |cert|. | 48 // Returns the OS-normalized issuer of |cert|. |
47 // macOS internally uses a normalized form of subject/issuer names for | 49 // macOS internally uses a normalized form of subject/issuer names for |
48 // comparing, roughly similar to RFC3280's normalization scheme. The | 50 // comparing, roughly similar to RFC3280's normalization scheme. The |
49 // normalized form is used for any database lookups and comparisons. | 51 // normalized form is used for any database lookups and comparisons. |
50 static base::ScopedCFTypeRef<CFDataRef> GetMacNormalizedIssuer( | 52 static base::ScopedCFTypeRef<CFDataRef> GetMacNormalizedIssuer( |
51 const scoped_refptr<ParsedCertificate>& cert); | 53 const ParsedCertificate* cert); |
52 | |
53 // Finds trust anchors with the Subject |name_data|, which should be | |
54 // normalized as by the OS. | |
55 void FindTrustAnchorsByMacNormalizedSubject(CFDataRef name_data, | |
56 TrustAnchors* matches) const; | |
57 | 54 |
58 const CFStringRef policy_oid_; | 55 const CFStringRef policy_oid_; |
59 | 56 |
60 DISALLOW_COPY_AND_ASSIGN(TrustStoreMac); | 57 DISALLOW_COPY_AND_ASSIGN(TrustStoreMac); |
61 }; | 58 }; |
62 | 59 |
63 } // namespace net | 60 } // namespace net |
64 | 61 |
65 #endif // NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ | 62 #endif // NET_CERT_INTERNAL_TRUST_STORE_MAC_H_ |
OLD | NEW |