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

Side by Side Diff: content/browser/ssl/ssl_client_auth_handler.h

Issue 1304143010: Plumbing SSLPrivateKey Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix rebase. Created 4 years, 10 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ 5 #ifndef CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ 6 #define CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
7 7
8 #include "base/callback.h" 8 #include "base/callback.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h" 10 #include "base/memory/ref_counted.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
14 #include "net/ssl/ssl_cert_request_info.h" 14 #include "net/ssl/ssl_cert_request_info.h"
15 #include "net/ssl/ssl_private_key.h"
15 16
16 namespace net { 17 namespace net {
17 class ClientCertStore; 18 class ClientCertStore;
18 class URLRequest; 19 class URLRequest;
19 class X509Certificate; 20 class X509Certificate;
20 } // namespace net 21 } // namespace net
21 22
22 namespace content { 23 namespace content {
23 24
24 // This class handles the approval and selection of a certificate for SSL client 25 // This class handles the approval and selection of a certificate for SSL client
25 // authentication by the user. Should only be used on the IO thread. If the 26 // authentication by the user. Should only be used on the IO thread. If the
26 // SSLClientAuthHandler is destroyed before the certificate is selected, the 27 // SSLClientAuthHandler is destroyed before the certificate is selected, the
27 // selection is canceled and the delegate never called. 28 // selection is canceled and the delegate never called.
28 class SSLClientAuthHandler { 29 class SSLClientAuthHandler {
29 public: 30 public:
30 // Delegate interface for SSLClientAuthHandler. Method implementations may 31 // Delegate interface for SSLClientAuthHandler. Method implementations may
31 // delete the handler when called. 32 // delete the handler when called.
32 class CONTENT_EXPORT Delegate { 33 class CONTENT_EXPORT Delegate {
33 public: 34 public:
34 Delegate() {} 35 Delegate() {}
35 36
36 // Called to continue the request with |cert|. |cert| may be nullptr. 37 // Called to continue the request with |cert| and |private_key|. |cert| and
37 virtual void ContinueWithCertificate(net::X509Certificate* cert) = 0; 38 // |private_key| may be nullptr.
39 virtual void ContinueWithCertificate(net::X509Certificate* cert,
40 net::SSLPrivateKey* private_key) = 0;
38 41
39 // Called to cancel the certificate selection and abort the request. 42 // Called to cancel the certificate selection and abort the request.
40 virtual void CancelCertificateSelection() = 0; 43 virtual void CancelCertificateSelection() = 0;
41 44
42 protected: 45 protected:
43 virtual ~Delegate() {} 46 virtual ~Delegate() {}
44 47
45 private: 48 private:
46 DISALLOW_COPY_AND_ASSIGN(Delegate); 49 DISALLOW_COPY_AND_ASSIGN(Delegate);
47 }; 50 };
48 51
49 // Creates a new SSLClientAuthHandler. The caller ensures that the handler 52 // Creates a new SSLClientAuthHandler. The caller ensures that the handler
50 // does not outlive |request| or |delegate|. 53 // does not outlive |request| or |delegate|.
51 SSLClientAuthHandler(scoped_ptr<net::ClientCertStore> client_cert_store, 54 SSLClientAuthHandler(scoped_ptr<net::ClientCertStore> client_cert_store,
52 net::URLRequest* request, 55 net::URLRequest* request,
53 net::SSLCertRequestInfo* cert_request_info, 56 net::SSLCertRequestInfo* cert_request_info,
54 Delegate* delegate); 57 Delegate* delegate);
55 ~SSLClientAuthHandler(); 58 ~SSLClientAuthHandler();
56 59
57 // Selects a certificate and resumes the URL request with that certificate. 60 // Selects a certificate and resumes the URL request with that certificate.
58 void SelectCertificate(); 61 void SelectCertificate();
59 62
60 // Called to continue the request associated with |handler| using |cert|. This 63 // Called to continue the request associated with |handler| using |cert|. This
61 // is static to avoid deleting |handler| while it is on the stack. 64 // is static to avoid deleting |handler| while it is on the stack.
62 static void ContinueWithCertificate( 65 static void ContinueWithCertificate(
63 const base::WeakPtr<SSLClientAuthHandler>& handler, 66 const base::WeakPtr<SSLClientAuthHandler>& handler,
64 net::X509Certificate* cert); 67 net::X509Certificate* cert,
68 net::SSLPrivateKey* pkey);
65 69
66 // Called to abort the request associated with |handler|. This is static to 70 // Called to abort the request associated with |handler|. This is static to
67 // avoid deleting |handler| while it is on the stack. 71 // avoid deleting |handler| while it is on the stack.
68 static void CancelCertificateSelection( 72 static void CancelCertificateSelection(
69 const base::WeakPtr<SSLClientAuthHandler>& handler); 73 const base::WeakPtr<SSLClientAuthHandler>& handler);
70 74
71 private: 75 private:
72 class Core; 76 class Core;
73 77
74 // Called when |core_| is done retrieving the cert list. 78 // Called when |core_| is done retrieving the cert list.
(...skipping 14 matching lines...) Expand all
89 Delegate* delegate_; 93 Delegate* delegate_;
90 94
91 base::WeakPtrFactory<SSLClientAuthHandler> weak_factory_; 95 base::WeakPtrFactory<SSLClientAuthHandler> weak_factory_;
92 96
93 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler); 97 DISALLOW_COPY_AND_ASSIGN(SSLClientAuthHandler);
94 }; 98 };
95 99
96 } // namespace content 100 } // namespace content
97 101
98 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_ 102 #endif // CONTENT_BROWSER_SSL_SSL_CLIENT_AUTH_HANDLER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/resource_loader_unittest.cc ('k') | content/browser/ssl/ssl_client_auth_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698