OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_VERIFIER_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_VERIFIER_H_ |
6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_VERIFIER_H_ | 6 #define CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_VERIFIER_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/cert/cert_trust_anchor_provider.h" | 16 #include "net/cert/cert_trust_anchor_provider.h" |
17 #include "net/cert/cert_verifier.h" | 17 #include "net/cert/cert_verifier.h" |
18 | 18 |
19 namespace net { | 19 namespace net { |
20 class CertVerifyProc; | |
20 class CertVerifyResult; | 21 class CertVerifyResult; |
21 class X509Certificate; | 22 class X509Certificate; |
22 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; | 23 typedef std::vector<scoped_refptr<X509Certificate> > CertificateList; |
23 } | 24 } |
24 | 25 |
25 namespace policy { | 26 namespace policy { |
26 | 27 |
27 // Wraps a MultiThreadedCertVerifier to make it use the additional trust anchors | 28 // Wraps a MultiThreadedCertVerifier to make it use the additional trust anchors |
28 // configured by the ONC user policy. | 29 // configured by the ONC user policy. |
29 class PolicyCertVerifier : public net::CertVerifier, | 30 class PolicyCertVerifier : public net::CertVerifier, |
30 public net::CertTrustAnchorProvider { | 31 public net::CertTrustAnchorProvider { |
31 public: | 32 public: |
32 // Except for tests, PolicyCertVerifier should only be created by | 33 // Except for tests, PolicyCertVerifier should only be created by |
33 // PolicyCertService, which is the counterpart of this class on the UI thread. | 34 // PolicyCertService, which is the counterpart of this class on the UI thread. |
34 // Except of the constructor, all methods and the destructor must be called on | 35 // Except of the constructor, all methods and the destructor must be called on |
35 // the IO thread. Calls |anchor_used_callback| on the IO thread everytime a | 36 // the IO thread. Calls |anchor_used_callback| on the IO thread everytime a |
36 // certificate from the additional trust anchors (set with SetTrustAnchors) is | 37 // certificate from the additional trust anchors (set with SetTrustAnchors) is |
37 // used. | 38 // used. |
38 explicit PolicyCertVerifier(const base::Closure& anchor_used_callback); | 39 explicit PolicyCertVerifier(const base::Closure& anchor_used_callback); |
39 virtual ~PolicyCertVerifier(); | 40 virtual ~PolicyCertVerifier(); |
40 | 41 |
41 void InitializeOnIOThread(); | 42 void InitializeOnIOThread(net::CertVerifyProc* verify_proc); |
Ryan Sleevi
2014/01/22 00:43:48
At the risk of extra typing, can you pass this as
mattm
2014/01/24 04:47:31
Done.
| |
42 | 43 |
43 // Sets the additional trust anchors. | 44 // Sets the additional trust anchors. |
44 void SetTrustAnchors(const net::CertificateList& trust_anchors); | 45 void SetTrustAnchors(const net::CertificateList& trust_anchors); |
45 | 46 |
46 // CertVerifier: | 47 // CertVerifier: |
47 // Note: |callback| can be null. | 48 // Note: |callback| can be null. |
48 virtual int Verify(net::X509Certificate* cert, | 49 virtual int Verify(net::X509Certificate* cert, |
49 const std::string& hostname, | 50 const std::string& hostname, |
50 int flags, | 51 int flags, |
51 net::CRLSet* crl_set, | 52 net::CRLSet* crl_set, |
(...skipping 11 matching lines...) Expand all Loading... | |
63 net::CertificateList trust_anchors_; | 64 net::CertificateList trust_anchors_; |
64 base::Closure anchor_used_callback_; | 65 base::Closure anchor_used_callback_; |
65 scoped_ptr<CertVerifier> delegate_; | 66 scoped_ptr<CertVerifier> delegate_; |
66 | 67 |
67 DISALLOW_COPY_AND_ASSIGN(PolicyCertVerifier); | 68 DISALLOW_COPY_AND_ASSIGN(PolicyCertVerifier); |
68 }; | 69 }; |
69 | 70 |
70 } // namespace policy | 71 } // namespace policy |
71 | 72 |
72 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_VERIFIER_H_ | 73 #endif // CHROME_BROWSER_CHROMEOS_POLICY_POLICY_CERT_VERIFIER_H_ |
OLD | NEW |