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/cert/cert_verify_proc_win.h" | 5 #include "net/cert/cert_verify_proc_win.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 verified_cert = cert; | 362 verified_cert = cert; |
363 } else { | 363 } else { |
364 verified_chain.push_back(cert); | 364 verified_chain.push_back(cert); |
365 } | 365 } |
366 } | 366 } |
367 | 367 |
368 if (verified_cert) { | 368 if (verified_cert) { |
369 // Add the root certificate, if present, as it was not added above. | 369 // Add the root certificate, if present, as it was not added above. |
370 if (has_root_ca) | 370 if (has_root_ca) |
371 verified_chain.push_back(element[num_elements]->pCertContext); | 371 verified_chain.push_back(element[num_elements]->pCertContext); |
372 verify_result->verified_cert = | 372 scoped_refptr<X509Certificate> verified_cert_with_chain = |
373 X509Certificate::CreateFromHandle(verified_cert, verified_chain); | 373 X509Certificate::CreateFromHandle(verified_cert, verified_chain); |
| 374 if (verified_cert_with_chain) |
| 375 verify_result->verified_cert = std::move(verified_cert_with_chain); |
| 376 else |
| 377 verify_result->cert_status |= CERT_STATUS_INVALID; |
374 } | 378 } |
375 } | 379 } |
376 | 380 |
377 // Decodes the cert's certificatePolicies extension into a CERT_POLICIES_INFO | 381 // Decodes the cert's certificatePolicies extension into a CERT_POLICIES_INFO |
378 // structure and stores it in *output. | 382 // structure and stores it in *output. |
379 void GetCertPoliciesInfo( | 383 void GetCertPoliciesInfo( |
380 PCCERT_CONTEXT cert, | 384 PCCERT_CONTEXT cert, |
381 std::unique_ptr<CERT_POLICIES_INFO, base::FreeDeleter>* output) { | 385 std::unique_ptr<CERT_POLICIES_INFO, base::FreeDeleter>* output) { |
382 PCERT_EXTENSION extension = CertFindExtension(szOID_CERT_POLICIES, | 386 PCERT_EXTENSION extension = CertFindExtension(szOID_CERT_POLICIES, |
383 cert->pCertInfo->cExtension, | 387 cert->pCertInfo->cExtension, |
(...skipping 824 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1208 return MapCertStatusToNetError(verify_result->cert_status); | 1212 return MapCertStatusToNetError(verify_result->cert_status); |
1209 | 1213 |
1210 if (ev_policy_oid && | 1214 if (ev_policy_oid && |
1211 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { | 1215 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { |
1212 verify_result->cert_status |= CERT_STATUS_IS_EV; | 1216 verify_result->cert_status |= CERT_STATUS_IS_EV; |
1213 } | 1217 } |
1214 return OK; | 1218 return OK; |
1215 } | 1219 } |
1216 | 1220 |
1217 } // namespace net | 1221 } // namespace net |
OLD | NEW |