Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(438)

Side by Side Diff: net/cert/test_root_certs.h

Issue 206453002: Introduce USE_OPENSSL_CERTS for certificate handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Final fixes and nits Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/cert/cert_verify_proc_unittest.cc ('k') | net/cert/test_root_certs_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_TEST_ROOT_CERTS_H_ 5 #ifndef NET_CERT_TEST_ROOT_CERTS_H_
6 #define NET_CERT_TEST_ROOT_CERTS_H_ 6 #define NET_CERT_TEST_ROOT_CERTS_H_
7 7
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "build/build_config.h" 10 #include "build/build_config.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 12
13 #if defined(USE_NSS) || defined(OS_IOS) 13 #if defined(USE_NSS) || defined(OS_IOS)
14 #include <list> 14 #include <list>
15 #elif defined(USE_OPENSSL) && !defined(OS_ANDROID) 15 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID)
16 #include <vector> 16 #include <vector>
17 #elif defined(OS_WIN) 17 #elif defined(OS_WIN)
18 #include <windows.h> 18 #include <windows.h>
19 #include <wincrypt.h> 19 #include <wincrypt.h>
20 #elif defined(OS_MACOSX) 20 #elif defined(OS_MACOSX)
21 #include <CoreFoundation/CFArray.h> 21 #include <CoreFoundation/CFArray.h>
22 #include <Security/SecTrust.h> 22 #include <Security/SecTrust.h>
23 #include "base/mac/scoped_cftyperef.h" 23 #include "base/mac/scoped_cftyperef.h"
24 #endif 24 #endif
25 25
26 #if defined(USE_NSS) 26 #if defined(USE_NSS)
27 typedef struct CERTCertificateStr CERTCertificate; 27 typedef struct CERTCertificateStr CERTCertificate;
28 #elif defined(USE_OPENSSL) && !defined(OS_ANDROID) 28 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID)
29 typedef struct x509_st X509; 29 typedef struct x509_st X509;
30 #endif 30 #endif
31 31
32 namespace base { 32 namespace base {
33 class FilePath; 33 class FilePath;
34 } 34 }
35 35
36 namespace net { 36 namespace net {
37 37
38 class X509Certificate; 38 class X509Certificate;
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 71
72 // Modifies the root certificates of |trust_ref| to include the 72 // Modifies the root certificates of |trust_ref| to include the
73 // certificates stored in |temporary_roots_|. If IsEmpty() is true, this 73 // certificates stored in |temporary_roots_|. If IsEmpty() is true, this
74 // does not modify |trust_ref|. 74 // does not modify |trust_ref|.
75 OSStatus FixupSecTrustRef(SecTrustRef trust_ref) const; 75 OSStatus FixupSecTrustRef(SecTrustRef trust_ref) const;
76 76
77 // Configures whether or not the default/system root store should also 77 // Configures whether or not the default/system root store should also
78 // be trusted. By default, this is true, indicating that the TestRootCerts 78 // be trusted. By default, this is true, indicating that the TestRootCerts
79 // are used in addition to OS trust store. 79 // are used in addition to OS trust store.
80 void SetAllowSystemTrust(bool allow_system_trust); 80 void SetAllowSystemTrust(bool allow_system_trust);
81 #elif defined(USE_OPENSSL) && !defined(OS_ANDROID) 81 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID)
82 const std::vector<scoped_refptr<X509Certificate> >& 82 const std::vector<scoped_refptr<X509Certificate> >&
83 temporary_roots() const { return temporary_roots_; } 83 temporary_roots() const { return temporary_roots_; }
84 bool Contains(X509* cert) const; 84 bool Contains(X509* cert) const;
85 #elif defined(OS_WIN) 85 #elif defined(OS_WIN)
86 HCERTSTORE temporary_roots() const { return temporary_roots_; } 86 HCERTSTORE temporary_roots() const { return temporary_roots_; }
87 87
88 // Returns an HCERTCHAINENGINE suitable to be used for certificate 88 // Returns an HCERTCHAINENGINE suitable to be used for certificate
89 // validation routines, or NULL to indicate that the default system chain 89 // validation routines, or NULL to indicate that the default system chain
90 // engine is appropriate. The caller is responsible for freeing the 90 // engine is appropriate. The caller is responsible for freeing the
91 // returned HCERTCHAINENGINE. 91 // returned HCERTCHAINENGINE.
92 HCERTCHAINENGINE GetChainEngine() const; 92 HCERTCHAINENGINE GetChainEngine() const;
93 #endif 93 #endif
94 94
95 private: 95 private:
96 friend struct base::DefaultLazyInstanceTraits<TestRootCerts>; 96 friend struct base::DefaultLazyInstanceTraits<TestRootCerts>;
97 97
98 TestRootCerts(); 98 TestRootCerts();
99 ~TestRootCerts(); 99 ~TestRootCerts();
100 100
101 // Performs platform-dependent initialization. 101 // Performs platform-dependent initialization.
102 void Init(); 102 void Init();
103 103
104 #if defined(USE_NSS) || defined(OS_IOS) 104 #if defined(USE_NSS) || defined(OS_IOS)
105 // It is necessary to maintain a cache of the original certificate trust 105 // It is necessary to maintain a cache of the original certificate trust
106 // settings, in order to restore them when Clear() is called. 106 // settings, in order to restore them when Clear() is called.
107 class TrustEntry; 107 class TrustEntry;
108 std::list<TrustEntry*> trust_cache_; 108 std::list<TrustEntry*> trust_cache_;
109 #elif defined(USE_OPENSSL) && !defined(OS_ANDROID) 109 #elif defined(USE_OPENSSL_CERTS) && !defined(OS_ANDROID)
110 std::vector<scoped_refptr<X509Certificate> > temporary_roots_; 110 std::vector<scoped_refptr<X509Certificate> > temporary_roots_;
111 #elif defined(OS_WIN) 111 #elif defined(OS_WIN)
112 HCERTSTORE temporary_roots_; 112 HCERTSTORE temporary_roots_;
113 #elif defined(OS_MACOSX) 113 #elif defined(OS_MACOSX)
114 base::ScopedCFTypeRef<CFMutableArrayRef> temporary_roots_; 114 base::ScopedCFTypeRef<CFMutableArrayRef> temporary_roots_;
115 bool allow_system_trust_; 115 bool allow_system_trust_;
116 #endif 116 #endif
117 117
118 #if defined(OS_WIN) || defined(OS_ANDROID) 118 #if defined(OS_WIN) || defined(OS_ANDROID)
119 // True if there are no temporarily trusted root certificates. 119 // True if there are no temporarily trusted root certificates.
(...skipping 20 matching lines...) Expand all
140 140
141 private: 141 private:
142 scoped_refptr<X509Certificate> cert_; 142 scoped_refptr<X509Certificate> cert_;
143 143
144 DISALLOW_COPY_AND_ASSIGN(ScopedTestRoot); 144 DISALLOW_COPY_AND_ASSIGN(ScopedTestRoot);
145 }; 145 };
146 146
147 } // namespace net 147 } // namespace net
148 148
149 #endif // NET_CERT_TEST_ROOT_CERTS_H_ 149 #endif // NET_CERT_TEST_ROOT_CERTS_H_
OLDNEW
« no previous file with comments | « net/cert/cert_verify_proc_unittest.cc ('k') | net/cert/test_root_certs_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698