Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ | |
| 6 #define NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ | |
| 7 | |
| 8 #include <string> | |
| 9 #include <vector> | |
| 10 | |
| 11 #include "base/basictypes.h" | |
| 12 #include "base/compiler_specific.h" | |
| 13 #include "base/memory/scoped_ptr.h" | |
| 14 #include "net/base/completion_callback.h" | |
| 15 #include "net/base/net_export.h" | |
| 16 #include "net/base/net_log.h" | |
| 17 #include "net/cert/cert_verify_result.h" | |
| 18 #include "net/cert/x509_certificate.h" | |
| 19 #include "net/quic/crypto/proof_verifier.h" | |
| 20 | |
| 21 namespace net { | |
| 22 | |
| 23 class BoundNetLog; | |
| 24 class CertVerifier; | |
| 25 class CertVerifyResult; | |
| 26 class SingleRequestCertVerifier; | |
| 27 class X509Certificate; | |
| 28 | |
| 29 struct CERTCertificateStr; | |
| 30 typedef struct CERTCertificateStr CERTCertificate; | |
|
wtc
2013/06/24 22:36:56
Delete these two lines. They are NSS-specific.
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 31 | |
| 32 // ProofVerifierChromium implements the QUIC ProofVerifier interface. | |
| 33 class NET_EXPORT_PRIVATE ProofVerifierChromium : public ProofVerifier { | |
| 34 public: | |
| 35 explicit ProofVerifierChromium(CertVerifier* cert_verifier); | |
| 36 virtual ~ProofVerifierChromium(); | |
| 37 | |
| 38 // ProofVerifier interface | |
| 39 virtual int VerifyProof(const std::string& hostname, | |
| 40 const std::string& server_config, | |
| 41 const std::vector<std::string>& certs, | |
| 42 const std::string& signature, | |
| 43 const CompletionCallback& callback, | |
| 44 std::string* error_details) OVERRIDE; | |
| 45 | |
| 46 // TODO(rtenneti): Do we need completed_cert_verification?? | |
|
wtc
2013/06/24 22:36:56
The completed_cert_verification() method doesn't s
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 47 bool completed_cert_verification() const { | |
| 48 return completed_cert_verification_; | |
| 49 } | |
| 50 | |
| 51 private: | |
| 52 enum State { | |
| 53 STATE_NONE, | |
| 54 STATE_VERIFY_CERT, | |
| 55 STATE_VERIFY_CERT_COMPLETE, | |
| 56 }; | |
| 57 | |
| 58 int VerifyChain(const std::vector<std::string>& certs); | |
| 59 | |
| 60 int DoVerifyCertLoop(int last_io_result); | |
| 61 void OnVerifyCertIOComplete(int result); | |
|
wtc
2013/06/24 22:36:56
These two functions can be named simply DoLoop(int
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 62 int DoVerifyCert(int result); | |
| 63 int DoVerifyCertComplete(int result); | |
| 64 | |
| 65 static bool VerifySignature(const std::string& signed_data, | |
| 66 const std::string& signature, | |
| 67 const std::string& cert); | |
| 68 | |
| 69 | |
|
wtc
2013/06/24 22:36:56
Delete one blank line.
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 70 // |cert_verifier_| and |verifier_| are used for verifying certificates. | |
| 71 CertVerifier* const cert_verifier_; | |
| 72 scoped_ptr<SingleRequestCertVerifier> verifier_; | |
| 73 | |
| 74 // |hostname| specifies the hostname for which |certs| is a valid chain. | |
| 75 std::string hostname_; | |
| 76 | |
| 77 CompletionCallback callback_; | |
| 78 | |
| 79 // True if the cert verification has been completed. | |
| 80 bool completed_cert_verification_; | |
| 81 | |
| 82 // The result of certificate verification. | |
| 83 CertVerifyResult server_cert_verify_result_; | |
|
wtc
2013/06/24 22:36:56
Remove "server_" from the member's name.
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 84 | |
| 85 // X509Certificate from a chain of DER encoded certificates. | |
| 86 scoped_refptr<X509Certificate> server_cert_; | |
|
wtc
2013/06/24 22:36:56
It may be sufficient to just name this member |cer
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 87 | |
| 88 State next_cert_state_; | |
|
wtc
2013/06/24 22:36:56
This member can be named simply next_state_.
ramant (doing other things)
2013/06/28 19:16:56
Done.
| |
| 89 | |
| 90 BoundNetLog net_log_; | |
| 91 | |
| 92 DISALLOW_COPY_AND_ASSIGN(ProofVerifierChromium); | |
| 93 }; | |
| 94 | |
| 95 } // namespace net | |
| 96 | |
| 97 #endif // NET_QUIC_CRYPTO_PROOF_VERIFIER_CHROMIUM_H_ | |
| OLD | NEW |