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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG; | 91 CERT_CHAIN_FIND_BY_ISSUER_CACHE_ONLY_URL_FLAG; |
92 for (;;) { | 92 for (;;) { |
93 // Find a certificate chain. | 93 // Find a certificate chain. |
94 chain_context = CertFindChainInStore(cert_store, | 94 chain_context = CertFindChainInStore(cert_store, |
95 X509_ASN_ENCODING, | 95 X509_ASN_ENCODING, |
96 find_flags, | 96 find_flags, |
97 CERT_CHAIN_FIND_BY_ISSUER, | 97 CERT_CHAIN_FIND_BY_ISSUER, |
98 &find_by_issuer_para, | 98 &find_by_issuer_para, |
99 chain_context); | 99 chain_context); |
100 if (!chain_context) { | 100 if (!chain_context) { |
101 if (GetLastError() != CRYPT_E_NOT_FOUND) | 101 if (GetLastError() != static_cast<DWORD>(CRYPT_E_NOT_FOUND)) |
102 DPLOG(ERROR) << "CertFindChainInStore failed: "; | 102 DPLOG(ERROR) << "CertFindChainInStore failed: "; |
103 break; | 103 break; |
104 } | 104 } |
105 | 105 |
106 // Get the leaf certificate. | 106 // Get the leaf certificate. |
107 PCCERT_CONTEXT cert_context = | 107 PCCERT_CONTEXT cert_context = |
108 chain_context->rgpChain[0]->rgpElement[0]->pCertContext; | 108 chain_context->rgpChain[0]->rgpElement[0]->pCertContext; |
109 // Copy the certificate, so that it is valid after |cert_store| is closed. | 109 // Copy the certificate, so that it is valid after |cert_store| is closed. |
110 PCCERT_CONTEXT cert_context2 = NULL; | 110 PCCERT_CONTEXT cert_context2 = NULL; |
111 BOOL ok = CertAddCertificateContextToStore(NULL, cert_context, | 111 BOOL ok = CertAddCertificateContextToStore(NULL, cert_context, |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
216 // copy). | 216 // copy). |
217 if (!CertFreeCertificateContext(cert)) | 217 if (!CertFreeCertificateContext(cert)) |
218 return false; | 218 return false; |
219 } | 219 } |
220 | 220 |
221 GetClientCertsImpl(test_store.get(), request, selected_certs); | 221 GetClientCertsImpl(test_store.get(), request, selected_certs); |
222 return true; | 222 return true; |
223 } | 223 } |
224 | 224 |
225 } // namespace net | 225 } // namespace net |
OLD | NEW |