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 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 } | 357 } |
358 | 358 |
359 for (DWORD i = 0; i < num_elements; ++i) { | 359 for (DWORD i = 0; i < num_elements; ++i) { |
360 PCCERT_CONTEXT cert = element[i]->pCertContext; | 360 PCCERT_CONTEXT cert = element[i]->pCertContext; |
361 if (i == 0) { | 361 if (i == 0) { |
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 const char* algorithm = cert->pCertInfo->SignatureAlgorithm.pszObjId; | 367 FillCertVerifyResultWeakSignature(cert, i == 0, verify_result); |
368 if (strcmp(algorithm, szOID_RSA_MD5RSA) == 0) { | |
369 // md5WithRSAEncryption: 1.2.840.113549.1.1.4 | |
370 verify_result->has_md5 = true; | |
371 } else if (strcmp(algorithm, szOID_RSA_MD2RSA) == 0) { | |
372 // md2WithRSAEncryption: 1.2.840.113549.1.1.2 | |
373 verify_result->has_md2 = true; | |
374 } else if (strcmp(algorithm, szOID_RSA_MD4RSA) == 0) { | |
375 // md4WithRSAEncryption: 1.2.840.113549.1.1.3 | |
376 verify_result->has_md4 = true; | |
377 } else if (strcmp(algorithm, szOID_RSA_SHA1RSA) == 0 || | |
378 strcmp(algorithm, szOID_X957_SHA1DSA) == 0 || | |
379 strcmp(algorithm, szOID_ECDSA_SHA1) == 0) { | |
380 // sha1WithRSAEncryption: 1.2.840.113549.1.1.5 | |
381 // id-dsa-with-sha1: 1.2.840.10040.4.3 | |
382 // ecdsa-with-SHA1: 1.2.840.10045.4.1 | |
383 verify_result->has_sha1 = true; | |
384 if (i == 0) | |
385 verify_result->has_sha1_leaf = true; | |
386 } | |
387 } | 368 } |
388 | 369 |
389 if (verified_cert) { | 370 if (verified_cert) { |
390 // Add the root certificate, if present, as it was not added above. | 371 // Add the root certificate, if present, as it was not added above. |
391 if (has_root_ca) | 372 if (has_root_ca) |
392 verified_chain.push_back(element[num_elements]->pCertContext); | 373 verified_chain.push_back(element[num_elements]->pCertContext); |
393 verify_result->verified_cert = | 374 verify_result->verified_cert = |
394 X509Certificate::CreateFromHandle(verified_cert, verified_chain); | 375 X509Certificate::CreateFromHandle(verified_cert, verified_chain); |
395 } | 376 } |
396 } | 377 } |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1236 return MapCertStatusToNetError(verify_result->cert_status); | 1217 return MapCertStatusToNetError(verify_result->cert_status); |
1237 | 1218 |
1238 if (ev_policy_oid && | 1219 if (ev_policy_oid && |
1239 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { | 1220 CheckEV(chain_context, rev_checking_enabled, ev_policy_oid)) { |
1240 verify_result->cert_status |= CERT_STATUS_IS_EV; | 1221 verify_result->cert_status |= CERT_STATUS_IS_EV; |
1241 } | 1222 } |
1242 return OK; | 1223 return OK; |
1243 } | 1224 } |
1244 | 1225 |
1245 } // namespace net | 1226 } // namespace net |
OLD | NEW |