OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 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 BLIMP_NET_EXACT_MATCH_CERT_VERIFIER_H_ |
| 6 #define BLIMP_NET_EXACT_MATCH_CERT_VERIFIER_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "blimp/net/blimp_net_export.h" |
| 11 #include "net/cert/cert_verifier.h" |
| 12 |
| 13 namespace blimp { |
| 14 |
| 15 // Checks if the peer certificate is an exact match to the X509 certificate |
| 16 // supplied out-of-band by the Blimp Assigner. |
| 17 // Rejects all certificates other than the |engine_cert| specified at |
| 18 // construction time. |
| 19 class BLIMP_NET_EXPORT ExactMatchCertVerifier : public net::CertVerifier { |
| 20 public: |
| 21 // |engine_cert|: The one allowable certificate. |
| 22 explicit ExactMatchCertVerifier( |
| 23 const scoped_refptr<net::X509Certificate>& engine_cert); |
| 24 |
| 25 ~ExactMatchCertVerifier() override; |
| 26 |
| 27 // net::CertVerifier implementation. |
| 28 int Verify(net::X509Certificate* cert, |
| 29 const std::string& hostname, |
| 30 const std::string& ocsp_response, |
| 31 int flags, |
| 32 net::CRLSet* crl_set, |
| 33 net::CertVerifyResult* verify_result, |
| 34 const net::CompletionCallback& callback, |
| 35 scoped_ptr<Request>* out_req, |
| 36 const net::BoundNetLog& net_log) override; |
| 37 |
| 38 private: |
| 39 scoped_refptr<net::X509Certificate> engine_cert_; |
| 40 |
| 41 DISALLOW_COPY_AND_ASSIGN(ExactMatchCertVerifier); |
| 42 }; |
| 43 |
| 44 } // namespace blimp |
| 45 |
| 46 #endif // BLIMP_NET_EXACT_MATCH_CERT_VERIFIER_H_ |
OLD | NEW |