OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "net/ssl/client_cert_store_win.h" | 5 #include "net/ssl/client_cert_store_win.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #define SECURITY_WIN32 // Needs to be defined before including security.h | 10 #define SECURITY_WIN32 // Needs to be defined before including security.h |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
122 for (DWORD i = 1; i < chain_context->rgpChain[0]->cElement; ++i) { | 122 for (DWORD i = 1; i < chain_context->rgpChain[0]->cElement; ++i) { |
123 PCCERT_CONTEXT chain_intermediate = | 123 PCCERT_CONTEXT chain_intermediate = |
124 chain_context->rgpChain[0]->rgpElement[i]->pCertContext; | 124 chain_context->rgpChain[0]->rgpElement[i]->pCertContext; |
125 PCCERT_CONTEXT copied_intermediate = NULL; | 125 PCCERT_CONTEXT copied_intermediate = NULL; |
126 ok = CertAddCertificateContextToStore(NULL, chain_intermediate, | 126 ok = CertAddCertificateContextToStore(NULL, chain_intermediate, |
127 CERT_STORE_ADD_USE_EXISTING, | 127 CERT_STORE_ADD_USE_EXISTING, |
128 &copied_intermediate); | 128 &copied_intermediate); |
129 if (ok) | 129 if (ok) |
130 intermediates.push_back(copied_intermediate); | 130 intermediates.push_back(copied_intermediate); |
131 } | 131 } |
132 // TODO(svaldez): Create Fake X509Certificate using CreateFromBytes and | |
133 // then return a tuple of the cert and SSLPrivateKey callback to create | |
134 // an SSLPrivateKey from the actual cert_context. Probably change | |
135 // CertificateList to be a pair<X509Certificate, SSLPrivateKeyCallback> | |
davidben
2015/09/25 20:10:11
Nit: Rather than "Fake X509Certificate", I would m
svaldez
2015/09/28 16:54:53
Done.
| |
132 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle( | 136 scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle( |
133 cert_context2, intermediates); | 137 cert_context2, intermediates); |
134 selected_certs->push_back(cert); | 138 selected_certs->push_back(cert); |
135 CertFreeCertificateContext(cert_context2); | 139 CertFreeCertificateContext(cert_context2); |
136 for (size_t i = 0; i < intermediates.size(); ++i) | 140 for (size_t i = 0; i < intermediates.size(); ++i) |
137 CertFreeCertificateContext(intermediates[i]); | 141 CertFreeCertificateContext(intermediates[i]); |
138 } | 142 } |
139 | 143 |
140 std::sort(selected_certs->begin(), selected_certs->end(), | 144 std::sort(selected_certs->begin(), selected_certs->end(), |
141 x509_util::ClientCertSorter()); | 145 x509_util::ClientCertSorter()); |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
201 // copy). | 205 // copy). |
202 if (!CertFreeCertificateContext(cert)) | 206 if (!CertFreeCertificateContext(cert)) |
203 return false; | 207 return false; |
204 } | 208 } |
205 | 209 |
206 GetClientCertsImpl(test_store.get(), request, selected_certs); | 210 GetClientCertsImpl(test_store.get(), request, selected_certs); |
207 return true; | 211 return true; |
208 } | 212 } |
209 | 213 |
210 } // namespace net | 214 } // namespace net |
OLD | NEW |