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

Side by Side Diff: net/cert/mock_client_cert_verifier.h

Issue 1474983003: Support for client certs in ssl_server_socket. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addresses reviewer comments Created 5 years 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
OLDNEW
(Empty)
1 // Copyright (c) 2015 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_CERT_MOCK_CLIENT_CERT_VERIFIER_H_
6 #define NET_CERT_MOCK_CLIENT_CERT_VERIFIER_H_
7
8 #include <list>
9
10 #include "net/cert/client_cert_verifier.h"
11
12 namespace net {
13
14 class MockClientCertVerifier : public ClientCertVerifier {
15 public:
16 // Creates a new MockClientCertVerifier. By default, any call to Verify() will
17 // result in the cert status being flagged as CERT_STATUS_INVALID and return
18 // an ERR_CERT_INVALID network error code. This behaviour can be overridden
19 // by calling set_default_result() to change the default return value for
20 // Verify() or by calling one of the AddResult*() methods to specifically
21 // handle a certificate or certificate and host.
22 MockClientCertVerifier();
23
24 ~MockClientCertVerifier() override;
25
26 // ClientCertVerifier implementation
27 int Verify(X509Certificate* cert) override;
28
29 // Sets the default return value for Verify() for certificates/hosts that do
30 // not have explicit results added via the AddResult*() methods.
31 void set_default_result(int default_result) {
32 default_result_ = default_result;
33 }
34
35 // Adds a rule that will cause any call to Verify() for |cert| to return rv.
36 // Note: Only the primary certificate of |cert| is checked. Any intermediate
37 // certificates will be ignored.
38 void AddResultForCert(X509Certificate* cert, int rv);
39
40 private:
41 struct Rule;
42 typedef std::list<Rule> RuleList;
43
44 int default_result_;
45 RuleList rules_;
46 };
47
48 } // namespace net
49
50 #endif // NET_CERT_MOCK_CLIENT_CERT_VERIFIER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698