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 NET_QUIC_CORE_CRYPTO_PROOF_VERIFIER_H_ | 5 #ifndef NET_QUIC_CORE_CRYPTO_PROOF_VERIFIER_H_ |
6 #define NET_QUIC_CORE_CRYPTO_PROOF_VERIFIER_H_ | 6 #define NET_QUIC_CORE_CRYPTO_PROOF_VERIFIER_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "net/base/net_export.h" | |
13 #include "net/quic/core/quic_packets.h" | 12 #include "net/quic/core/quic_packets.h" |
14 #include "net/quic/core/quic_types.h" | 13 #include "net/quic/core/quic_types.h" |
| 14 #include "net/quic/platform/api/quic_export.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 // ProofVerifyDetails is an abstract class that acts as a container for any | 18 // ProofVerifyDetails is an abstract class that acts as a container for any |
19 // implementation specific details that a ProofVerifier wishes to return. These | 19 // implementation specific details that a ProofVerifier wishes to return. These |
20 // details are saved in the CachedState for the origin in question. | 20 // details are saved in the CachedState for the origin in question. |
21 class NET_EXPORT_PRIVATE ProofVerifyDetails { | 21 class QUIC_EXPORT_PRIVATE ProofVerifyDetails { |
22 public: | 22 public: |
23 virtual ~ProofVerifyDetails() {} | 23 virtual ~ProofVerifyDetails() {} |
24 | 24 |
25 // Returns an new ProofVerifyDetails object with the same contents | 25 // Returns an new ProofVerifyDetails object with the same contents |
26 // as this one. | 26 // as this one. |
27 virtual ProofVerifyDetails* Clone() const = 0; | 27 virtual ProofVerifyDetails* Clone() const = 0; |
28 }; | 28 }; |
29 | 29 |
30 // ProofVerifyContext is an abstract class that acts as a container for any | 30 // ProofVerifyContext is an abstract class that acts as a container for any |
31 // implementation specific context that a ProofVerifier needs. | 31 // implementation specific context that a ProofVerifier needs. |
32 class NET_EXPORT_PRIVATE ProofVerifyContext { | 32 class QUIC_EXPORT_PRIVATE ProofVerifyContext { |
33 public: | 33 public: |
34 virtual ~ProofVerifyContext() {} | 34 virtual ~ProofVerifyContext() {} |
35 }; | 35 }; |
36 | 36 |
37 // ProofVerifierCallback provides a generic mechanism for a ProofVerifier to | 37 // ProofVerifierCallback provides a generic mechanism for a ProofVerifier to |
38 // call back after an asynchronous verification. | 38 // call back after an asynchronous verification. |
39 class NET_EXPORT_PRIVATE ProofVerifierCallback { | 39 class QUIC_EXPORT_PRIVATE ProofVerifierCallback { |
40 public: | 40 public: |
41 virtual ~ProofVerifierCallback() {} | 41 virtual ~ProofVerifierCallback() {} |
42 | 42 |
43 // Run is called on the original thread to mark the completion of an | 43 // Run is called on the original thread to mark the completion of an |
44 // asynchonous verification. If |ok| is true then the certificate is valid | 44 // asynchonous verification. If |ok| is true then the certificate is valid |
45 // and |error_details| is unused. Otherwise, |error_details| contains a | 45 // and |error_details| is unused. Otherwise, |error_details| contains a |
46 // description of the error. |details| contains implementation-specific | 46 // description of the error. |details| contains implementation-specific |
47 // details of the verification. |Run| may take ownership of |details| by | 47 // details of the verification. |Run| may take ownership of |details| by |
48 // calling |release| on it. | 48 // calling |release| on it. |
49 virtual void Run(bool ok, | 49 virtual void Run(bool ok, |
50 const std::string& error_details, | 50 const std::string& error_details, |
51 std::unique_ptr<ProofVerifyDetails>* details) = 0; | 51 std::unique_ptr<ProofVerifyDetails>* details) = 0; |
52 }; | 52 }; |
53 | 53 |
54 // A ProofVerifier checks the signature on a server config, and the certificate | 54 // A ProofVerifier checks the signature on a server config, and the certificate |
55 // chain that backs the public key. | 55 // chain that backs the public key. |
56 class NET_EXPORT_PRIVATE ProofVerifier { | 56 class QUIC_EXPORT_PRIVATE ProofVerifier { |
57 public: | 57 public: |
58 virtual ~ProofVerifier() {} | 58 virtual ~ProofVerifier() {} |
59 | 59 |
60 // VerifyProof checks that |signature| is a valid signature of | 60 // VerifyProof checks that |signature| is a valid signature of |
61 // |server_config| by the public key in the leaf certificate of |certs|, and | 61 // |server_config| by the public key in the leaf certificate of |certs|, and |
62 // that |certs| is a valid chain for |hostname|. On success, it returns | 62 // that |certs| is a valid chain for |hostname|. On success, it returns |
63 // QUIC_SUCCESS. On failure, it returns QUIC_FAILURE and sets |*error_details| | 63 // QUIC_SUCCESS. On failure, it returns QUIC_FAILURE and sets |*error_details| |
64 // to a description of the problem. In either case it may set |*details|, | 64 // to a description of the problem. In either case it may set |*details|, |
65 // which the caller takes ownership of. | 65 // which the caller takes ownership of. |
66 // | 66 // |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const std::vector<std::string>& certs, | 104 const std::vector<std::string>& certs, |
105 const ProofVerifyContext* context, | 105 const ProofVerifyContext* context, |
106 std::string* error_details, | 106 std::string* error_details, |
107 std::unique_ptr<ProofVerifyDetails>* details, | 107 std::unique_ptr<ProofVerifyDetails>* details, |
108 std::unique_ptr<ProofVerifierCallback> callback) = 0; | 108 std::unique_ptr<ProofVerifierCallback> callback) = 0; |
109 }; | 109 }; |
110 | 110 |
111 } // namespace net | 111 } // namespace net |
112 | 112 |
113 #endif // NET_QUIC_CORE_CRYPTO_PROOF_VERIFIER_H_ | 113 #endif // NET_QUIC_CORE_CRYPTO_PROOF_VERIFIER_H_ |
OLD | NEW |