| 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_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 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 }; | 30 }; |
| 31 | 31 |
| 32 // ProofVerifierCallback provides a generic mechanism for a ProofVerifier to | 32 // ProofVerifierCallback provides a generic mechanism for a ProofVerifier to |
| 33 // call back after an asynchronous verification. | 33 // call back after an asynchronous verification. |
| 34 class NET_EXPORT_PRIVATE ProofVerifierCallback { | 34 class NET_EXPORT_PRIVATE ProofVerifierCallback { |
| 35 public: | 35 public: |
| 36 virtual ~ProofVerifierCallback() {} | 36 virtual ~ProofVerifierCallback() {} |
| 37 | 37 |
| 38 // Run is called on the original thread to mark the completion of an | 38 // Run is called on the original thread to mark the completion of an |
| 39 // asynchonous verification. If |ok| is true then the certificate is valid | 39 // asynchonous verification. If |ok| is true then the certificate is valid |
| 40 // and |*error_details| is unused. Otherwise, |*error_details| contains a | 40 // and |error_details| is unused. Otherwise, |error_details| contains a |
| 41 // description of the error. |details| contains implementation-specific | 41 // description of the error. |details| contains implementation-specific |
| 42 // details of the verification. |Run| may take ownership of |details| by | 42 // details of the verification. |Run| may take ownership of |details| by |
| 43 // calling |release| on it. | 43 // calling |release| on it. |
| 44 virtual void Run(bool ok, | 44 virtual void Run(bool ok, |
| 45 const std::string& error_details, | 45 const std::string& error_details, |
| 46 scoped_ptr<ProofVerifyDetails>* details) = 0; | 46 scoped_ptr<ProofVerifyDetails>* details) = 0; |
| 47 }; | 47 }; |
| 48 | 48 |
| 49 // A ProofVerifier checks the signature on a server config, and the certificate | 49 // A ProofVerifier checks the signature on a server config, and the certificate |
| 50 // chain that backs the public key. | 50 // chain that backs the public key. |
| 51 class NET_EXPORT_PRIVATE ProofVerifier { | 51 class NET_EXPORT_PRIVATE ProofVerifier { |
| 52 public: | 52 public: |
| 53 virtual ~ProofVerifier() {} | 53 virtual ~ProofVerifier() {} |
| 54 | 54 |
| 55 // VerifyProof checks that |signature| is a valid signature of | 55 // VerifyProof checks that |signature| is a valid signature of |
| 56 // |server_config| by the public key in the leaf certificate of |certs|, and | 56 // |server_config| by the public key in the leaf certificate of |certs|, and |
| 57 // that |certs| is a valid chain for |hostname|. On success, it returns | 57 // that |certs| is a valid chain for |hostname|. On success, it returns |
| 58 // QUIC_SUCCESS. On failure, it returns QUIC_ERROR and sets |*error_details| | 58 // QUIC_SUCCESS. On failure, it returns QUIC_FAILURE and sets |*error_details| |
| 59 // to a description of the problem. In either case it may set |*details|, | 59 // to a description of the problem. In either case it may set |*details|, |
| 60 // which the caller takes ownership of. | 60 // which the caller takes ownership of. |
| 61 // | 61 // |
| 62 // |context| specifies an implementation specific struct (which may be NULL | 62 // |context| specifies an implementation specific struct (which may be NULL |
| 63 // for some implementations) that provides useful information for the | 63 // for some implementations) that provides useful information for the |
| 64 // verifier, e.g. logging handles. | 64 // verifier, e.g. logging handles. |
| 65 // | 65 // |
| 66 // This function may also return QUIC_PENDING, in which case the ProofVerifier | 66 // This function may also return QUIC_PENDING, in which case the ProofVerifier |
| 67 // will call back, on the original thread, via |callback| when complete. | 67 // will call back, on the original thread, via |callback| when complete. |
| 68 // In this case, the ProofVerifier will take ownership of |callback|. | 68 // In this case, the ProofVerifier will take ownership of |callback|. |
| 69 // | 69 // |
| 70 // The signature uses SHA-256 as the hash function and PSS padding in the | 70 // The signature uses SHA-256 as the hash function and PSS padding in the |
| 71 // case of RSA. | 71 // case of RSA. |
| 72 virtual QuicAsyncStatus VerifyProof(const std::string& hostname, | 72 virtual QuicAsyncStatus VerifyProof(const std::string& hostname, |
| 73 const std::string& server_config, | 73 const std::string& server_config, |
| 74 const std::vector<std::string>& certs, | 74 const std::vector<std::string>& certs, |
| 75 const std::string& signature, | 75 const std::string& signature, |
| 76 const ProofVerifyContext* context, | 76 const ProofVerifyContext* context, |
| 77 std::string* error_details, | 77 std::string* error_details, |
| 78 scoped_ptr<ProofVerifyDetails>* details, | 78 scoped_ptr<ProofVerifyDetails>* details, |
| 79 ProofVerifierCallback* callback) = 0; | 79 ProofVerifierCallback* callback) = 0; |
| 80 }; | 80 }; |
| 81 | 81 |
| 82 } // namespace net | 82 } // namespace net |
| 83 | 83 |
| 84 #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_H_ | 84 #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_H_ |
| OLD | NEW |