Chromium Code Reviews| 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/base/x509_certificate.h" | 5 #include "net/base/x509_certificate.h" |
| 6 | 6 |
| 7 #include <CommonCrypto/CommonDigest.h> | 7 #include <CommonCrypto/CommonDigest.h> |
| 8 #include <CoreServices/CoreServices.h> | 8 #include <CoreServices/CoreServices.h> |
| 9 #include <Security/Security.h> | 9 #include <Security/Security.h> |
| 10 #include <time.h> | 10 #include <time.h> |
| (...skipping 1475 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1486 if ((*certs)[i]->fingerprint().Equals(fingerprint)) | 1486 if ((*certs)[i]->fingerprint().Equals(fingerprint)) |
| 1487 break; | 1487 break; |
| 1488 } | 1488 } |
| 1489 if (i < certs->size()) | 1489 if (i < certs->size()) |
| 1490 continue; | 1490 continue; |
| 1491 | 1491 |
| 1492 bool is_preferred = preferred_identity && | 1492 bool is_preferred = preferred_identity && |
| 1493 CFEqual(preferred_identity, identity); | 1493 CFEqual(preferred_identity, identity); |
| 1494 | 1494 |
| 1495 // Make sure the issuer matches valid_issuers, if given. | 1495 // Make sure the issuer matches valid_issuers, if given. |
| 1496 // But an explicit cert preference overrides this. | 1496 if (!valid_issuers.empty() && |
| 1497 if (!is_preferred && | |
| 1498 !valid_issuers.empty() && | |
| 1499 !cert->IsIssuedBy(valid_issuers)) | 1497 !cert->IsIssuedBy(valid_issuers)) |
|
wtc
2012/03/15 01:44:53
Nit: this conditional expression should fit in one
| |
| 1500 continue; | 1498 continue; |
| 1501 | 1499 |
| 1502 // The cert passes, so add it to the vector. | 1500 // The cert passes, so add it to the vector. |
| 1503 // If it's the preferred identity, add it at the start (so it'll be | 1501 // If it's the preferred identity, add it at the start (so it'll be |
| 1504 // selected by default in the UI.) | 1502 // selected by default in the UI.) |
| 1505 if (is_preferred) | 1503 if (is_preferred) |
| 1506 certs->insert(certs->begin(), cert); | 1504 certs->insert(certs->begin(), cert); |
| 1507 else | 1505 else |
| 1508 certs->push_back(cert); | 1506 certs->push_back(cert); |
| 1509 } | 1507 } |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1626 *type = kPublicKeyTypeDH; | 1624 *type = kPublicKeyTypeDH; |
| 1627 break; | 1625 break; |
| 1628 default: | 1626 default: |
| 1629 *type = kPublicKeyTypeUnknown; | 1627 *type = kPublicKeyTypeUnknown; |
| 1630 *size_bits = 0; | 1628 *size_bits = 0; |
| 1631 break; | 1629 break; |
| 1632 } | 1630 } |
| 1633 } | 1631 } |
| 1634 | 1632 |
| 1635 } // namespace net | 1633 } // namespace net |
| OLD | NEW |