| OLD | NEW |
| 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 #include "net/ssl/client_cert_store_impl.h" | 5 #include "net/ssl/client_cert_store_impl.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 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 136 for (size_t i = 0; i < intermediates.size(); ++i) | 136 for (size_t i = 0; i < intermediates.size(); ++i) |
| 137 CertFreeCertificateContext(intermediates[i]); | 137 CertFreeCertificateContext(intermediates[i]); |
| 138 } | 138 } |
| 139 | 139 |
| 140 std::sort(selected_certs->begin(), selected_certs->end(), | 140 std::sort(selected_certs->begin(), selected_certs->end(), |
| 141 x509_util::ClientCertSorter()); | 141 x509_util::ClientCertSorter()); |
| 142 } | 142 } |
| 143 | 143 |
| 144 } // namespace | 144 } // namespace |
| 145 | 145 |
| 146 ClientCertStoreImpl::ClientCertStoreImpl() {} |
| 147 |
| 148 ClientCertStoreImpl::~ClientCertStoreImpl() {} |
| 149 |
| 146 void ClientCertStoreImpl::GetClientCerts(const SSLCertRequestInfo& request, | 150 void ClientCertStoreImpl::GetClientCerts(const SSLCertRequestInfo& request, |
| 147 CertificateList* selected_certs, | 151 CertificateList* selected_certs, |
| 148 const base::Closure& callback) { | 152 const base::Closure& callback) { |
| 149 // Client certificates of the user are in the "MY" system certificate store. | 153 // Client certificates of the user are in the "MY" system certificate store. |
| 150 HCERTSTORE my_cert_store = CertOpenSystemStore(NULL, L"MY"); | 154 HCERTSTORE my_cert_store = CertOpenSystemStore(NULL, L"MY"); |
| 151 if (!my_cert_store) { | 155 if (!my_cert_store) { |
| 152 PLOG(ERROR) << "Could not open the \"MY\" system certificate store: "; | 156 PLOG(ERROR) << "Could not open the \"MY\" system certificate store: "; |
| 153 selected_certs->clear(); | 157 selected_certs->clear(); |
| 154 callback.Run(); | 158 callback.Run(); |
| 155 return; | 159 return; |
| (...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 // copy). | 201 // copy). |
| 198 if (!CertFreeCertificateContext(cert)) | 202 if (!CertFreeCertificateContext(cert)) |
| 199 return false; | 203 return false; |
| 200 } | 204 } |
| 201 | 205 |
| 202 GetClientCertsImpl(test_store.get(), request, selected_certs); | 206 GetClientCertsImpl(test_store.get(), request, selected_certs); |
| 203 return true; | 207 return true; |
| 204 } | 208 } |
| 205 | 209 |
| 206 } // namespace net | 210 } // namespace net |
| OLD | NEW |