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

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

Issue 12220104: Wire up SSL client authentication for OpenSSL/Android through the net/ stack (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 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
(Empty)
1 // Copyright (c) 2013 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_OPENSSL_KEY_STORE_H
6 #define NET_BASE_OPENSSL_KEY_STORE_H
7
8 #include "net/base/net_export.h"
9
10 // Avoid including <openssl/evp.h> here.
11 typedef struct evp_pkey_st EVP_PKEY;
12
13 namespace net {
14
15 class X509Certificate;
16
17 // Tell the network stack to use a specific OpenSSL private key 'object'
18 // to implement signing during a SSL handshake that requires client
19 // authentication. Can be called from any thread.
20 //
21 // Typically, SSL connection handling with client authentication works
22 // in several steps:
23 //
24 // 1/ SSLClientSocket::Connect() is called, and returns with an error
25 // (ERR_SSL_CLIENT_AUTH_CERT_NEEDED) to indicate that client
26 // authentication is required.
27 //
28 // 2/ The caller then asks the user for a client certificate chain
29 // (i.e. with a UI dialog), and stores it in the |client_cert| field
30 // of the net::SSLConfig used to handle the connection.
31 //
32 // 3/ The caller invokes SSLClientSocket::Connect() again. This time,
33 // the client certificate chain stored in 2/ is used, as well as the
34 // corresponding private key, to sign the hash in the
35 // "Verify Certificate" message sent to the server.
36 //
37 // Note that in step 3/, the ::Connect() code only receives a handle to
38 // the client certificate, and needs a way to sign a message with the
39 // matching private key.
40 //
41 // OpenSSL doesn't provide a way to do this, because it doesn't implement
42 // a key store. And on Android, the keystore platform APIs do not provide
43 // a way to do it either.
44 //
45 // This is solved by using this function in step 2, as follows:
46 //
47 // 1/ Unchanged.
48 //
49 // 2/ Let the user select a client certificate, and retrieve both
50 // its certificate chain and a reference to its private key.
51 //
52 // 2b/ Call net::UseClientCertSigningPrivateKey() to let the network
53 // stack record the association between the client certificate's
54 // public key, and its private key handle.
55 //
56 // 3/ When Connect() is called the second time, use the certificate
57 // chain from the net::SSLConfig, and use its public key to retrieve
58 // the previously-stored private key reference. See
59 // net::OpenSSLPrivateKeyStore::FetchClientCertPrivateKey(), which
60 // is not exported by the network stack.
61 //
62 // |client_certificate| is the client certificate.
63 // |private_key| holds the corresponding private key.
64 // Returns true on success, false otherwise. On success, this increments
65 // the reference count of |private_key|.
66 bool NET_EXPORT UseOpenSSLClientCertSigningPrivateKey(
67 const X509Certificate& client_certificate, EVP_PKEY* private_key);
Ryan Sleevi 2013/02/12 00:25:17 Is it really necessary to create another file for
digit1 2013/02/12 15:05:25 There is a need for a single NET_EXPORT function t
Ryan Sleevi 2013/02/12 20:12:58 While I'm amenable to replacing it, I think having
digit1 2013/02/13 18:24:34 openssl_util.* and openssl_key_store.* are now gon
68
69 } // namespace net
70
71 #endif // NET_BASE_OPENSSL_KEY_STORE_H
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698