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

Side by Side Diff: net/quic/crypto/proof_verifier.h

Issue 20898003: Revert 213862 "net: make QUIC ProofVerifier more generic." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1578/src/
Patch Set: Created 7 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « net/quic/crypto/proof_test.cc ('k') | net/quic/crypto/proof_verifier.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) 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_CRYPTO_PROOF_VERIFIER_H_ 5 #ifndef NET_QUIC_CRYPTO_PROOF_VERIFIER_H_
6 #define NET_QUIC_CRYPTO_PROOF_VERIFIER_H_ 6 #define NET_QUIC_CRYPTO_PROOF_VERIFIER_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "net/base/completion_callback.h" 11 #include "net/base/completion_callback.h"
12 #include "net/base/net_export.h" 12 #include "net/base/net_export.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 class CertVerifyResult; 16 class CertVerifyResult;
17 17
18 // ProofVerifyDetails is an abstract class that acts as a container for any
19 // implementation specific details that a ProofVerifier wishes to return. These
20 // details are saved in the CachedInfo for the origin in question.
21 class ProofVerifyDetails {
22 public:
23 virtual ~ProofVerifyDetails();
24 };
25
26 // ProofVerifierCallback provides a generic mechanism for a ProofVerifier to
27 // call back after an asynchronous verification.
28 class NET_EXPORT_PRIVATE ProofVerifierCallback {
29 public:
30 virtual ~ProofVerifierCallback();
31
32 // Run is called on the original thread to mark the completion of an
33 // asynchonous verification. If |ok| is true then the certificate is valid
34 // and |*error_details| is unused. Otherwise, |*error_details| contains a
35 // description of the error. |details| contains implementation-specific
36 // details of the verification. |Run| may take ownership of |details| by
37 // calling |release| on it.
38 virtual void Run(bool ok,
39 const std::string& error_details,
40 scoped_ptr<ProofVerifyDetails>* details) = 0;
41 };
42
43 // A ProofVerifier checks the signature on a server config, and the certificate 18 // A ProofVerifier checks the signature on a server config, and the certificate
44 // chain that backs the public key. 19 // chain that backs the public key.
45 class NET_EXPORT_PRIVATE ProofVerifier { 20 class NET_EXPORT_PRIVATE ProofVerifier {
46 public: 21 public:
47 // Status enumerates the possible results of verifying a proof. 22 virtual ~ProofVerifier() {}
48 enum Status {
49 SUCCESS = 0,
50 FAILURE = 1,
51 // PENDING results from a verification which will occur asynchonously. When
52 // the verification is complete, |callback|'s |Run| method will be called.
53 PENDING = 2,
54 };
55
56 virtual ~ProofVerifier();
57 23
58 // VerifyProof checks that |signature| is a valid signature of 24 // VerifyProof checks that |signature| is a valid signature of
59 // |server_config| by the public key in the leaf certificate of |certs|, and 25 // |server_config| by the public key in the leaf certificate of |certs|, and
60 // that |certs| is a valid chain for |hostname|. On success, it returns 26 // that |certs| is a valid chain for |hostname|. On success, it returns OK.
61 // SUCCESS. On failure, it returns ERROR and sets |*error_details| to a 27 // On failure, it returns ERR_FAILED and sets |*error_details| to a
62 // description of the problem. In either case it may set |*details|, which the 28 // description of the problem. This function may also return ERR_IO_PENDING,
63 // caller takes ownership of. 29 // in which case the |callback| will be run on the calling thread with the
64 // 30 // final OK/ERR_FAILED result when the proof is verified.
65 // This function may also return PENDING, in which case the ProofVerifier
66 // will call back, on the original thread, via |callback| when complete.
67 //
68 // This function takes ownership of |callback|. It will be deleted even if
69 // the call returns immediately.
70 // 31 //
71 // The signature uses SHA-256 as the hash function and PSS padding in the 32 // The signature uses SHA-256 as the hash function and PSS padding in the
72 // case of RSA. 33 // case of RSA.
73 virtual Status VerifyProof(const std::string& hostname, 34 //
74 const std::string& server_config, 35 // Note: this is just for testing. The CN of the certificate is ignored and
75 const std::vector<std::string>& certs, 36 // wildcards in the SANs are not supported.
76 const std::string& signature, 37 virtual int VerifyProof(const std::string& hostname,
77 std::string* error_details, 38 const std::string& server_config,
78 scoped_ptr<ProofVerifyDetails>* details, 39 const std::vector<std::string>& certs,
79 ProofVerifierCallback* callback) = 0; 40 const std::string& signature,
41 std::string* error_details,
42 CertVerifyResult* cert_verify_result,
43 const CompletionCallback& callback) = 0;
80 }; 44 };
81 45
82 } // namespace net 46 } // namespace net
83 47
84 #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_H_ 48 #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_H_
OLDNEW
« no previous file with comments | « net/quic/crypto/proof_test.cc ('k') | net/quic/crypto/proof_verifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698