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

Side by Side Diff: net/base/ssl_client_auth_cache.h

Issue 12680003: net: split net/ssl out of net/base (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 9 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/base/ssl_cipher_suite_names_unittest.cc ('k') | net/base/ssl_client_auth_cache.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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_BASE_SSL_CLIENT_AUTH_CACHE_H_
6 #define NET_BASE_SSL_CLIENT_AUTH_CACHE_H_
7
8 #include <string>
9 #include <map>
10
11 #include "base/compiler_specific.h"
12 #include "base/memory/ref_counted.h"
13 #include "net/base/cert_database.h"
14 #include "net/base/net_export.h"
15
16 namespace net {
17
18 class X509Certificate;
19
20 // The SSLClientAuthCache class is a simple cache structure to store SSL
21 // client certificates. Provides lookup, insertion, and deletion of entries.
22 // The parameter for doing lookups, insertions, and deletions is the server's
23 // host and port.
24 //
25 // TODO(wtc): This class is based on FtpAuthCache. We can extract the common
26 // code to a template class.
27 class NET_EXPORT_PRIVATE SSLClientAuthCache : public CertDatabase::Observer {
28 public:
29 SSLClientAuthCache();
30 virtual ~SSLClientAuthCache();
31
32 // Checks for a client certificate preference for SSL server at |server|.
33 // Returns true if a preference is found, and sets |*certificate| to the
34 // desired client certificate. The desired certificate may be NULL, which
35 // indicates a preference to not send any certificate to |server|.
36 // If a certificate preference is not found, returns false.
37 bool Lookup(const std::string& server,
38 scoped_refptr<X509Certificate>* certificate);
39
40 // Add a client certificate for |server| to the cache. If there is already
41 // a client certificate for |server|, it will be overwritten. A NULL
42 // |client_cert| indicates a preference that no client certificate should
43 // be sent to |server|.
44 void Add(const std::string& server, X509Certificate* client_cert);
45
46 // Remove the client certificate for |server| from the cache, if one exists.
47 void Remove(const std::string& server);
48
49 // CertDatabase::Observer methods:
50 virtual void OnCertAdded(const X509Certificate* cert) OVERRIDE;
51
52 private:
53 typedef std::string AuthCacheKey;
54 typedef scoped_refptr<X509Certificate> AuthCacheValue;
55 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap;
56
57 // internal representation of cache, an STL map.
58 AuthCacheMap cache_;
59 };
60
61 } // namespace net
62
63 #endif // NET_BASE_SSL_CLIENT_AUTH_CACHE_H_
OLDNEW
« no previous file with comments | « net/base/ssl_cipher_suite_names_unittest.cc ('k') | net/base/ssl_client_auth_cache.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698