OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 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_SSL_SSL_CLIENT_AUTH_CACHE_H_ | 5 #ifndef NET_SSL_SSL_CLIENT_AUTH_CACHE_H_ |
6 #define NET_SSL_SSL_CLIENT_AUTH_CACHE_H_ | 6 #define NET_SSL_SSL_CLIENT_AUTH_CACHE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 #include <utility> | 10 #include <utility> |
(...skipping 28 matching lines...) Expand all Loading... |
39 // If a certificate preference is not found, returns false. | 39 // If a certificate preference is not found, returns false. |
40 bool Lookup(const HostPortPair& server, | 40 bool Lookup(const HostPortPair& server, |
41 scoped_refptr<X509Certificate>* certificate, | 41 scoped_refptr<X509Certificate>* certificate, |
42 scoped_refptr<SSLPrivateKey>* private_key); | 42 scoped_refptr<SSLPrivateKey>* private_key); |
43 | 43 |
44 // Add a client certificate and private key for |server| to the cache. If | 44 // Add a client certificate and private key for |server| to the cache. If |
45 // there is already a client certificate for |server|, it will be | 45 // there is already a client certificate for |server|, it will be |
46 // overwritten. A NULL |client_cert| indicates a preference that no client | 46 // overwritten. A NULL |client_cert| indicates a preference that no client |
47 // certificate should be sent to |server|. | 47 // certificate should be sent to |server|. |
48 void Add(const HostPortPair& server, | 48 void Add(const HostPortPair& server, |
49 X509Certificate* client_cert, | 49 scoped_refptr<X509Certificate> client_cert, |
50 SSLPrivateKey* private_key); | 50 scoped_refptr<SSLPrivateKey> private_key); |
51 | 51 |
52 // Remove the client certificate for |server| from the cache, if one exists. | 52 // Remove the client certificate for |server| from the cache, if one exists. |
53 void Remove(const HostPortPair& server); | 53 void Remove(const HostPortPair& server); |
54 | 54 |
55 // CertDatabase::Observer methods: | 55 // CertDatabase::Observer methods: |
56 void OnCertDBChanged() override; | 56 void OnCertDBChanged() override; |
57 | 57 |
58 private: | 58 private: |
59 typedef HostPortPair AuthCacheKey; | 59 typedef HostPortPair AuthCacheKey; |
60 typedef std::pair<scoped_refptr<X509Certificate>, | 60 typedef std::pair<scoped_refptr<X509Certificate>, |
61 scoped_refptr<SSLPrivateKey>> AuthCacheValue; | 61 scoped_refptr<SSLPrivateKey>> AuthCacheValue; |
62 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap; | 62 typedef std::map<AuthCacheKey, AuthCacheValue> AuthCacheMap; |
63 | 63 |
64 // internal representation of cache, an STL map. | 64 // internal representation of cache, an STL map. |
65 AuthCacheMap cache_; | 65 AuthCacheMap cache_; |
66 }; | 66 }; |
67 | 67 |
68 } // namespace net | 68 } // namespace net |
69 | 69 |
70 #endif // NET_SSL_SSL_CLIENT_AUTH_CACHE_H_ | 70 #endif // NET_SSL_SSL_CLIENT_AUTH_CACHE_H_ |
OLD | NEW |